Hi. I'm writing a console program that uses ReadConsoleInput() to receive input from a mouseclick. My problem is that the program gets "stuck" at ReadConsoleInput() when there are no "events". I need some sort of a timeout function that gets out of ReadConsoleInput() after a certain amount of no event time, say 5 seconds. Here's how my program is like:
I tried using WaitForSingleObject(hStdin, 5000L) and putting it after the line ReadConsoleInput(hStdin,irInBuf,128, &cNumRead);Code:for (int i=0; i<=30; i++){ ... while (1){ ReadConsoleInput(hStdin,irInBuf,128, &cNumRead); if (irInBuf[cNumRead-1].Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED ) { ... break; } } ... }
But that only seem to work for the first time around the for loop. I would really appreciate any help I can get on this.
Thank you.



LinkBack URL
About LinkBacks



) And sorry about posting it on the wrong board!