3,248
社区成员




void CUseMsComm32OCXDlg::OpenCom(int iCom)
{
m_MyMSComm.SetCommPort(iCom);
// HANDLE com_id=(HANDLE) m_MyMSComm.GetCommID();
// COMMTIMEOUTS CommTimeOuts;
// ZeroMemory(&CommTimeOuts,sizeof(CommTimeOuts));
// SetCommTimeouts(com_id,&CommTimeOuts);
// 9600 baud, no parity, 8 data, and 1 stop bit.
m_MyMSComm.SetSettings("9600,N,8,1");
// Use Binary
m_MyMSComm.SetInputMode(ComInputModeBinary);
// Tell the control to read entire buffer when Input is used.
m_MyMSComm.SetInputLen(0);
// Open the port.
m_MyMSComm.SetPortOpen(true);
m_MyMSComm.GetInput();
//
CString prompt;
prompt.Format("COM Settings: COM%d,9600,N,8,1",iCom);
m_ComSettings.SetWindowText(prompt);
}
//