GetNumberOfConsoleInputEvents

  BOOL GetNumberOfConsoleInputEvents(hConsoleInput, lpcNumberOfEvents)    
  HANDLE hConsoleInput; /* open console input handle */
  LPDWORD lpcNumberOfEvents; /* address for number of events */

The GetNumberOfConsoleInputEvents function retrieves the number of events waiting in the console input queue.

Parameters

hConsoleInput

Specifies an open handle with GENERIC_READ access to the console input buffer.

lpcNumberOfEvents

Points to the variable that receives the number of events in the console input queue.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

This function reports the number of keyboard, mouse, and window resize events in the input buffer. Applications using ReadFile to read from the input buffer will only be able to read keyboard events.

WaitForSingleObject or WaitForMultipleObjects can be used to wait for a handle to console input to be Signalled. This occurs when the input buffer is not empty.

See Also

PeekConsoleInput, ReadConsoleInput