//{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
// !defined(AFX_CLASS1DLG_H__B8BA98C1_5D58_47BE_B664_E97E77EC5076__INCLUDED_)
6ģ
6.1ϵͳʼģ
ϵͳijʼģ£ BOOL CClass1Dlg::OnInitDialog() { CDialog::OnInitDialog(); // Add \ // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here m_ctrlComm.SetCommPort(4); //ѡCOM4 m_ctrlComm.SetInputMode(1); //뷽ʽΪƷʽ m_ctrlComm.SetInBufferSize(1024); //뻺С m_ctrlComm.SetOutBufferSize(512); //С //9600У飬8λ1ֹͣλ m_ctrlComm.SetSettings(\
-7-
}
if(!m_ctrlComm.GetPortOpen()) m_ctrlComm.SetPortOpen(TRUE);// m_ctrlComm.SetRThreshold(1); //1ʾÿڽջж //1ַʱһݵOnComm¼ m_ctrlComm.SetInputLen(0); //õǰݳΪ0 m_ctrlComm.GetInput(); //Ԥ return TRUE; // return TRUE unless you set the focus to a control
6.2úʾģ
еġáťáԻͼ7.1ʾڸöԻôڵͨŲĴ£
void CClass1Dlg::OnSetting() {
// TODO: Add your control notification handler code here CSettingDlg setDlg;
setDlg.DoModal();//DoModal()CSettingDlgԱͨø
//ʾԻ }
6.3ģ
еġݡťѷݷ͵ڵֵĽͼ7.3(a)(b)ʾĴ£
void CClass1Dlg::OnButtonManualsend() { }
-8-
m_ctrlComm.GetInput();
// TODO: Add your control notification handler code here UpdateData(TRUE); //ȡ༭
m_ctrlComm.SetOutput(COleVariant(m_strEditTXData));//
6.4ݽݷģ еġťݽݷݣͼ7.6ʾĴ£
void CClass1Dlg::Oncls() {
// TODO: Add your control notification handler code here
m_strEditTXData=_T(\ m_strEditRXData=_T(\ }
UpdateData(FALSE);
6.5رģ
еġťرոڣͼ7.8ʾĴ£ void CClass1Dlg::OnEnd() { }
// TODO: Add your control notification handler code here CDialog::OnOK();
7ϵͳ
7.1
ȣֱ˫class1ļµdebugļµclass1.exeļ Σ²вԣ
-9-
(1)
ã ͼ
7.1
2:
ͼ7.2
-10-