资源介绍
串口工具收发,代码简单明了,适合初学者,vs
void CSerialTestDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
CString str,strCOM,strBaud;
int com,baud;
GetDlgItemText(IDC_BUTTON1,str);
// GetDlgItemText(IDC_COMBO_COM,strCOM);
com=m_cmb_com.GetCurSel()+1;
GetDlgItemText(IDC_COMBO_BAUD,strBaud);
baud = _ttoi(strBaud);
if(str==_T("打开串口"))
{
if(m_Serial.OpenPort(this->m_hWnd,com,baud))
{
m_Serial.m_OnSeriesRead = m_OnSeriesRead; //设置回调函数接口
SetDlgItemText(IDC_BUTTON1,_T("关闭串口"));
}
}
else if(str==_T("关闭串口"))
{
m_Serial.ClosePort();
SetDlgItemText(IDC_BUTTON1,_T("打开串口"));
}
}
- 上一篇: QR__在vc++6.0下编译——源代码.rar
- 下一篇: SQL添加字段vb6.0实例源代码