|
《evc高级编程及其应用开发》例程中这样用OnOk(),OnClose(), 为何?
[复制链接]
void CDlgSeriesSetup::OnBtnopen()
{
CComboBox *pCmbName = NULL;
CComboBox *pCmbBaud = NULL;
CComboBox *pCmbParity = NULL;
CComboBox *pCmbDataBits = NULL;
CComboBox *pCmbStopBits = NULL;
pCmbName = (CComboBox*)GetDlgItem(IDC_CMBNAME);
pCmbBaud = (CComboBox*)GetDlgItem(IDC_CMBBAUD);
pCmbParity = (CComboBox*)GetDlgItem(IDC_CMBPARITY);
pCmbDataBits = (CComboBox*)GetDlgItem(IDC_CMBDATABITS);
pCmbStopBits = (CComboBox*)GetDlgItem(IDC_CMBSTOPBITS);
ASSERT(pCmbName != NULL);
ASSERT(pCmbBaud != NULL);
ASSERT(pCmbParity != NULL);
ASSERT(pCmbDataBits != NULL);
ASSERT(pCmbStopBits != NULL);
//得到串口编号
CString tmpCommName;
pCmbName->GetWindowText(tmpCommName);
m_portNo = _wtoi(tmpCommName);
//得到波特率
CString tmpBaud;
pCmbBaud->GetWindowText(tmpBaud);
m_baud = _wtoi(tmpBaud);
//得到奇偶校验
m_parity = pCmbParity->GetCurSel();
//得到数据位
CString tmpDataBits;
pCmbDataBits->GetWindowText(tmpDataBits);
m_databits = _wtoi(tmpDataBits);
//得到停止位
m_stopbits = pCmbStopBits->GetCurSel();
OnOK();
}
void CDlgSeriesSetup::OnBtnclose()
{
OnClose();
}
OnOK(), OnClose()这两个函数怎莫这样用?
看msdn里面都与按钮ok close相联系, 而自动添加的CDilog::OnOK() CDilog::OnClose();的用法
|
|