I am using the serial tutorial there. I am trying to perform overlapped communication so I can monitor both a keyboard event and the event where the CTS line changes state.

Here is my code:
    osReader.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    printf("\n\nConnecting...     (F1 to quit)\n");
    printlog("Establishing connection...");
    DWORD BytesReadOV;
    int err;
    unsigned int undef = 1;
    while(undef & 1){
                dwRes = WaitForSingleObject(osReader.hEvent, 100);
                if(dwRes == WAIT_TIMEOUT){
                                     if(getch() == 0x00){
                                                if(getch() == KEY_F1) undef = -1;
                if(dwRes == WAIT_OBJECT_0){
                         undef = 0;
                if(undef == -1){
                         printf(" cancelled!");
The osReader.hEvent never gets signalled, so it always times out. I should mention that the device I am communicating with does work. I have a beta terminal program that does not use overlapped IO, but it has a few leak problems. Most notibly, Ctrl+C'ing out of the program left me with file handle leaks.

Anyone see something I didnt do right?

PS: The osReader is an OVERLAPPED structure and the serial HANDLE is set for overlapped IO.

Last edited by AP2k; 30Sep2006 at 02:08..