GENERIC_WRITE, file://打开类型为可读写
0, file://以独占模式打开串口
NULL, file://不设置安全属性
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, file://重叠I/O方式
0);
if (m_hComm == INVALID_HANDLE_VALUE) file://打开不成功
{return FALSE;}
m_CommTimeouts.ReadIntervalTimeout = 1000;
file://进行超时设置,读者应根据自己的实际需要设置
m_CommTimeouts.ReadTotalTimeoutMultiplier = 500;
m_CommTimeouts.ReadTotalTimeoutConstant = 5000;
m_CommTimeouts.WriteTotalTimeoutMultiplier = 500;
m_CommTimeouts.WriteTotalTimeoutConstant = 5000;
if (!SetCommTimeouts(m_hComm, &m_CommTimeouts))
{CloseHandle(m_hComm);
return FALSE;}
PurgeComm(m_hComm, PURGE_RXCLEAR (北联网教程,专业提供视频软件下载)
……