{break; }case87: {break; }default: { port->ProcessErrorMessage("WaitCommEvent()");break; } } }else{ bResult= ClearCommError(port->m_hComm, &dwError, &comstat);if(comstat.cbInQue ==0)continue; }//end if bResult//m_hEventArray[0] = m_hShutdownEvent;//highest priority//m_hEvent...
PurgeComm(port->m_hComm, PURGE_RXCLEAR | PURGE_TXCLEAR | PURGE_RXABORT | PURGE_TXABORT); for (;;) { bResult = WaitCommEvent(port->m_hComm, &Event, &port->m_ov); if (!bResult) { switch (dwError = GetLastError()) { case ERROR_IO_PENDING: { break; } case 87: { break; }...
你这里使用了异步方式读取,ERROR_IO_PENDING返回值时可以用等待函数等port->m_ov中事件变成有信号状态,要么你就直接用同步串口方式读取。