123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- // ComportDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "DlgComport.h"
- #include ".\dlgcomport.h"
- #include "MainFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgComport property page
- IMPLEMENT_DYNCREATE(CDlgComport, CPropertyPage)
- CDlgComport::CDlgComport() : CPropertyPage(CDlgComport::IDD)
- , m_strUID(_T(""))
- , m_strDevName(_T(""))
- ,m_strDevArea(_T(""))
- , m_nTimeout(0)
- , m_nDevAddr(0)
- , m_nCommPort(0)
- , m_nRate(0)
- , m_nCheckCode(0)
- , m_nNetIP(0)
- , m_nNetPort(0)
- , m_nDataBit(0)
- , m_nStopBit(0)
- , m_strReserved6(_T(""))
- , m_strReserved7(_T(""))
- , m_strReserved8(_T(""))
- , m_strReserved9(_T(""))
- , m_strReserved10(_T(""))
- , m_nReserved6(0)
- , m_nReserved7(0)
- , m_nReserved8(0)
- , m_nReserved9(0)
- , m_nReserved10(0)
- , m_bReserved6(FALSE)
- , m_bReserved7(FALSE)
- , m_bReserved8(FALSE)
- , m_bReserved9(FALSE)
- , m_bReserved10(FALSE)
- {
- //{{AFX_DATA_INIT(CDlgComport)
- //}}AFX_DATA_INIT
- }
- CDlgComport::~CDlgComport()
- {
- }
- void CDlgComport::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgComport)
- //}}AFX_DATA_MAP
- DDX_Text(pDX, IDC_EDT_DEV_UID, m_strUID);
- DDX_Text(pDX, IDC_EDT_DEV_NAME, m_strDevName);
- DDX_Text(pDX, IDC_EDT_DEV_AREA, m_strDevArea);
- DDX_Text(pDX, IDC_EDT_TIMEOUT, m_nTimeout);
- DDX_Text(pDX, IDC_EDT_DEV_ADDR, m_nDevAddr);
- DDV_MinMaxInt(pDX, m_nDevAddr, 0, 254);
- DDX_Text(pDX, IDC_EDT_COMM_PORT, m_nCommPort);
- DDV_MinMaxInt(pDX, m_nCommPort, 1, 255);
- DDX_CBIndex(pDX, IDC_COMBO_RATE, m_nRate);
- DDX_CBIndex(pDX, IDC_COMBO_CHECK_CODE, m_nCheckCode);
- DDX_IPAddress(pDX, IDC_IPADDR_DEV, m_nNetIP);
- DDX_Text(pDX, IDC_EDT_NET_PORT, m_nNetPort);
- DDX_Radio(pDX, IDC_RADIO_DATA_BIT_7, m_nDataBit);
- DDX_Radio(pDX, IDC_RADIO_STOP_BIT_0, m_nStopBit);
- }
- BEGIN_MESSAGE_MAP(CDlgComport, CPropertyPage)
- //{{AFX_MSG_MAP(CDlgComport)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgComport message handlers
- BOOL CDlgComport::OnSetActive()
- {
- // TODO: 在此添加专用代码和/或调用基类
- CPropertySheet* pParent=(CPropertySheet*)GetParent();
- pParent->SetWizardButtons(PSWIZB_FINISH|PSWIZB_BACK);
- return CPropertyPage::OnSetActive();
- }
- BOOL CDlgComport::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
- // TODO: 在此添加额外的初始化
- ChangeCtrlState();
- return TRUE; // return TRUE unless you set the focus to a control
- // 异常: OCX 属性页应返回 FALSE
- }
- void CDlgComport::ChangeCtrlState( bool bStu2000 )
- {
- GetDlgItem(IDC_STATIC_NET)->EnableWindow(m_nCommunicateMode == 0 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_DEV_IP)->EnableWindow(m_nCommunicateMode == 0 ? FALSE : TRUE);
- GetDlgItem(IDC_IPADDR_DEV)->EnableWindow(m_nCommunicateMode == 0 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_NET_PORT)->EnableWindow(m_nCommunicateMode == 0 ? FALSE : TRUE);
- GetDlgItem(IDC_EDT_NET_PORT)->EnableWindow(m_nCommunicateMode == 0 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_COMM)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_DEV_ADDR)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_EDT_DEV_ADDR)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_COMM_PORT)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_EDT_COMM_PORT)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_DATA_BIT)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_RADIO_DATA_BIT_7)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_RADIO_DATA_BIT_8)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_RATE)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_COMBO_RATE)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_STOP_BIT)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_RADIO_STOP_BIT_0)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_RADIO_STOP_BIT_1)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_RADIO_STOP_BIT_2)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_STATIC_CHECK_CODE)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- GetDlgItem(IDC_COMBO_CHECK_CODE)->EnableWindow(m_nCommunicateMode == 1 ? FALSE : TRUE);
- CMainFrame *pMainFrm=(CMainFrame*)AfxGetApp()->m_pMainWnd;
- // if( pMainFrm->m_wndDevice.m_bIsStu2000 )
- // {
- // GetDlgItem(IDC_STATIC_DEV_ADDR)->EnableWindow(TRUE);
- // GetDlgItem(IDC_EDT_DEV_ADDR)->EnableWindow(TRUE);
- // }
- }
- LRESULT CDlgComport::OnWizardBack()
- {
- // TODO: 在此添加专用代码和/或调用基类
- UpdateData( false );
- return CPropertyPage::OnWizardBack();
- }
|