Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

twait.c

Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 1985 - 1999, Microsoft Corporation 00003 */ 00004 00005 #include "precomp.h" 00006 #pragma hdrstop 00007 #pragma hdrstop 00008 00009 00010 DWORD 00011 main(VOID) 00012 { 00013 DWORD Status; 00014 ULONG BytesTransferred; 00015 INPUT_RECORD Char; 00016 BOOL Success; 00017 HANDLE Array[1]; 00018 int i; 00019 00020 FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); 00021 for (i=0;i<2;i++) { 00022 printf("Waiting...\n"); 00023 Status = WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE),-1); 00024 if (Status != 0) { 00025 printf("wait failed %lx\n",Status); 00026 return 1; 00027 } 00028 Success = ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE), 00029 &Char, 00030 1, 00031 &BytesTransferred 00032 ); 00033 if (Status != 0) { 00034 printf("read failed %lx\n",Status); 00035 return 1; 00036 } 00037 if (BytesTransferred != 1) { 00038 printf("Read returned %d chars\n",BytesTransferred); 00039 } 00040 printf("Read returned %c\n",Char.Event.KeyEvent.uChar.AsciiChar); 00041 } 00042 00043 Array[0] = GetStdHandle(STD_INPUT_HANDLE); 00044 for (i=0;i<2;i++) { 00045 printf("Waiting...\n"); 00046 Status = WaitForMultipleObjects(1,Array,FALSE,-1); 00047 if (Status != 0) { 00048 printf("wait failed %lx\n",Status); 00049 return 1; 00050 } 00051 Success = ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE), 00052 &Char, 00053 1, 00054 &BytesTransferred 00055 ); 00056 if (Status != 0) { 00057 printf("read failed %lx\n",Status); 00058 return 1; 00059 } 00060 if (BytesTransferred != 1) { 00061 printf("Read returned %d chars\n",BytesTransferred); 00062 } 00063 printf("Read returned %c\n",Char.Event.KeyEvent.uChar.AsciiChar); 00064 } 00065 }

Generated on Sat May 15 19:42:10 2004 for test by doxygen 1.3.7