Here is to monitor the any character arrives in COM Port
if (!WaitCommEvent(COM1, &dwCommEvent, &osStatus))
if (GetLastError() != ERROR_IO_PENDING) // Wait not delayed!!
/*ERROR HANDLING HERE*/
deRes = WaitForSingleObject(osStatus.hEvent,3000);
case WAIT_OBJECT 0:
/*osStatus.hEvent gets signaled*/
// }//end while(TRUE)
Here I hope those varaibles are cleared with the names.
The problem is that the GetLastError() is not pending after the first round WM_TIMEOUT,I just can't say the reason, but is there any way to avoid the error if I want to restart from WaitCommEvent() after every WM_TIMEOUT??
Thanx for the help!!!