From: <re...@us...> - 2005-01-31 21:43:12
|
Update of /cvsroot/crystal/CS/libs/csutil/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2680/libs/csutil/win32 Modified Files: win32.cpp Log Message: res fixed the Win32 "Press a key" message not working in all cases. Index: win32.cpp =================================================================== RCS file: /cvsroot/crystal/CS/libs/csutil/win32/win32.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- win32.cpp 22 Jan 2005 02:45:58 -0000 1.20 +++ win32.cpp 31 Jan 2005 21:42:49 -0000 1.21 @@ -541,14 +541,19 @@ { printf ("\nPress a key to close this window..."); fflush (stdout); - HANDLE hConsole = GetStdHandle (STD_INPUT_HANDLE); - INPUT_RECORD ir; - DWORD events_read; - do + HANDLE hConsole; + hConsole = CreateFile ("CONIN$", GENERIC_READ, FILE_SHARE_READ, 0, + OPEN_EXISTING, 0, 0); + if (hConsole != 0) { - ReadConsoleInput (hConsole, &ir, 1, &events_read); - } while ((events_read == 0) || (ir.EventType != KEY_EVENT)); - CloseHandle (hConsole); + INPUT_RECORD ir; + DWORD events_read; + do + { + ReadConsoleInput (hConsole, &ir, 1, &events_read); + } while ((events_read == 0) || (ir.EventType != KEY_EVENT)); + CloseHandle (hConsole); + } } } |