?? adaptdlg.cpp
字號:
/*
** FILENAME ConfigDlg.cpp
**
** PURPOSE Here the ports can be configured
**
** CREATION DATE 15-09-1997
** LAST MODIFICATION 12-11-1997
**
** AUTHOR Remon Spekreijse
**
*/
#include "stdafx.h"
#include "AdaptDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CadptDlg dialog
CadptDlg::CadptDlg(CWnd* pParent /*=NULL*/)
: CDialog(CadptDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CadptDlg)
m_LBaRate = _T("");
m_LDaBits = _T("");
m_LEqual = _T("");
m_LStBits = _T("");
m_LPort=0;
m_LInOut = _T("");
//}}AFX_DATA_INIT
m_LChuan=TRUE;
m_LInOut=_T("956");
}
//DEL CadptDlg::CadptDlg(CWnd* pParent, WORD nIO)
//DEL : CDialog(CadptDlg::IDD, pParent)
//DEL {
//DEL m_LChuan=FALSE;
//DEL itoa(nIO,m_LInOut.GetBuffer(10),10);
//DEL m_LInOut.ReleaseBuffer();
//DEL
//DEL m_Ldcb.BaudRate=19200;
//DEL m_Ldcb.ByteSize=8;
//DEL m_Ldcb.StopBits=1;
//DEL m_Ldcb.Parity=NOPARITY;
//DEL }
CadptDlg::CadptDlg(CWnd* pParent, BOOL bSerial,DCB dcb,WORD nIO,int nPort)
: CDialog(CadptDlg::IDD, pParent)
{
m_LChuan=bSerial;
m_Ldcb = dcb;
itoa(nIO,m_LInOut.GetBuffer(10),10);
m_LInOut.ReleaseBuffer();
m_LPort=nPort;
}
void CadptDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CadptDlg)
DDX_CBString(pDX, IDC_BAUDRATECOMBO, m_LBaRate);
DDX_CBString(pDX, IDC_DATABITSCOMBO, m_LDaBits);
DDX_CBString(pDX, IDC_PARITYCOMBO, m_LEqual);
DDX_CBString(pDX, IDC_STOPBITSCOMBO, m_LStBits);
DDX_CBIndex(pDX, IDC_COMCOMBO, m_LPort);
DDX_Text(pDX, IDC_EDITIO, m_LInOut);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CadptDlg, CDialog)
//{{AFX_MSG_MAP(CadptDlg)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CadptDlg message handlers
BOOL CadptDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString strTemp;
strTemp.Format("%d", m_Ldcb.BaudRate);
((CComboBox*)GetDlgItem(IDC_BAUDRATECOMBO))->SelectString(0, strTemp);
((CComboBox*)GetDlgItem(IDC_PARITYCOMBO))->SetCurSel(m_Ldcb.Parity);
strTemp.Format("%d", m_Ldcb.StopBits);
int n=((CComboBox*)GetDlgItem(IDC_STOPBITSCOMBO))->FindStringExact(0,strTemp);
((CComboBox*)GetDlgItem(IDC_STOPBITSCOMBO))->SetCurSel(n);
// SetDlgItemText(IDC_STOPBITSCOMBO,strTemp);
//((CComboBox*)GetDlgItem(IDC_STOPBITSCOMBO))->SelectString(0, strTemp);
strTemp.Format("%d", m_Ldcb.ByteSize);
((CComboBox*)GetDlgItem(IDC_DATABITSCOMBO))->SelectString(0, strTemp);
((CComboBox*)GetDlgItem(IDC_COMCOMBO))->SetCurSel(m_LPort);
CButton* pBu;
if(m_LChuan)
{
pBu=(CButton*)GetDlgItem(IDC_RADIO1);
pBu->SetCheck(BST_CHECKED);
CWnd* pWnd= GetDlgItem(IDC_BAUDRATECOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_PARITYCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_DATABITSCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_STOPBITSCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_COMCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_EDITIO);
pWnd->EnableWindow(FALSE);
}
else
{
pBu=(CButton*)GetDlgItem(IDC_RADIO2);
pBu->SetCheck(BST_CHECKED);
CWnd* pWnd= GetDlgItem(IDC_BAUDRATECOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_PARITYCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_DATABITSCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_STOPBITSCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_COMCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_EDITIO);
pWnd->EnableWindow(TRUE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CadptDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
CWnd* pWnd= GetDlgItem(IDC_BAUDRATECOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_PARITYCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_DATABITSCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_STOPBITSCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_COMCOMBO);
pWnd->EnableWindow(FALSE);
pWnd= GetDlgItem(IDC_EDITIO);
pWnd->EnableWindow(TRUE);
m_LChuan=FALSE;
}
void CadptDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
CWnd* pWnd= GetDlgItem(IDC_BAUDRATECOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_PARITYCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_DATABITSCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_STOPBITSCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_COMCOMBO);
pWnd->EnableWindow(TRUE);
pWnd= GetDlgItem(IDC_EDITIO);
pWnd->EnableWindow(FALSE);
m_LChuan=TRUE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -