資源簡介
本程序主要解決了串口接收數據的過程中出現亂碼和數據丟失的情況,特別適合于串口通信的初學者.希望能夠對大家有所幫助

代碼片段和文件信息
//?ConfigPort.cpp?:?實現文件
//
#include?“stdafx.h“
#include?“SerialPort.h“
#include?“ConfigPort.h“
#include?“afxdialogex.h“
//?ConfigPort?對話框
IMPLEMENT_DYNAMIC(ConfigPort?CDialogEx)
ConfigPort::ConfigPort(CWnd*?pParent?/*=NULL*/)
:?CDialogEx(ConfigPort::IDD?pParent)
?m_PortRate(_T(““))
?m_DataNum(_T(““))
?m_StopNum(_T(““))
?m_ParityBit(0)
{
}
ConfigPort::~ConfigPort()
{
}
void?ConfigPort::DoDataExchange(CDataExchange*?pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_CBString(pDX?IDC_PortRate?m_PortRate);
DDX_CBString(pDX?IDC_DATANUM?m_DataNum);
DDX_CBString(pDX?IDC_STOPNUM?m_StopNum);
DDX_CBIndex(pDX?IDC_PARITYBIT?m_ParityBit);
}
BEGIN_MESSAGE_MAP(ConfigPort?CDialogEx)
END_MESSAGE_MAP()
//?ConfigPort?消息處理程序
BOOL?ConfigPort::OnInitDialog()
{
CDialogEx::OnInitDialog();
//?TODO:??在此添加額外的初始化
((CComboBox*)(GetDlgItem(IDC_PortRate)))->SetCurSel(0);
((CComboBox*)(GetDlgItem(IDC_DATANUM)))->SetCurSel(0);
((CComboBox*)(GetDlgItem(IDC_STOPNUM)))->SetCurSel(0);
((CComboBox*)(GetDlgItem(IDC_PARITYBIT)))->SetCurSel(0);
return?TRUE;??//?return?TRUE?unless?you?set?the?focus?to?a?control
//?異常:?OCX?屬性頁應返回?FALSE
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-06-02?19:51??SerialPort\
?????目錄???????????0??2015-05-31?15:23??SerialPort\SerialPort\
?????文件????????1246??2015-05-31?10:35??SerialPort\SerialPort\ConfigPort.cpp
?????文件?????????486??2015-05-31?10:35??SerialPort\SerialPort\ConfigPort.h
?????文件????????3070??2015-05-28?16:42??SerialPort\SerialPort\ReadMe.txt
?????文件??????107216??2015-05-31?14:49??SerialPort\SerialPort\SerialPort.aps
?????文件????????2045??2015-05-28?16:42??SerialPort\SerialPort\SerialPort.cpp
?????文件?????????466??2015-05-28?16:42??SerialPort\SerialPort\SerialPort.h
?????文件???????13890??2015-05-31?14:49??SerialPort\SerialPort\SerialPort.rc
?????文件????????6032??2015-05-31?09:30??SerialPort\SerialPort\SerialPort.vcxproj
?????文件????????2195??2015-05-31?09:30??SerialPort\SerialPort\SerialPort.vcxproj.filters
?????文件?????????143??2015-05-28?16:42??SerialPort\SerialPort\SerialPort.vcxproj.user
?????文件????????6214??2015-05-31?15:17??SerialPort\SerialPort\SerialPortDlg.cpp
?????文件?????????913??2015-05-31?15:03??SerialPort\SerialPort\SerialPortDlg.h
?????目錄???????????0??2015-05-31?10:57??SerialPort\SerialPort\res\
?????文件???????67777??2009-08-31?02:31??SerialPort\SerialPort\res\SerialPort.ico
?????文件?????????676??2015-05-28?16:42??SerialPort\SerialPort\res\SerialPort.rc2
?????文件????????2284??2015-05-31?14:49??SerialPort\SerialPort\resource.h
?????文件?????????143??2015-05-28?16:42??SerialPort\SerialPort\stdafx.cpp
?????文件????????1632??2015-05-28?16:42??SerialPort\SerialPort\stdafx.h
?????文件?????????234??2015-05-28?16:42??SerialPort\SerialPort\targetver.h
?????文件?????????897??2015-05-28?16:42??SerialPort\SerialPort.sln
?????文件???????27648??2015-06-02?19:51??SerialPort\SerialPort.suo
評論
共有 條評論