GetNumberOfConsoleInputEvents  106HE2O 

The GetNumberOfConsoleInputEvents function retrieves the number of unread input records in the console s input buffer.

BOOL GetNumberOfConsoleInputEvents(

    HANDLE hConsoleInput,

// handle of console input buffer

    LPDWORD lpcNumberOfEvents

// address for number of events

   );

 

 

Parameters

hConsoleInput

Identifies the console input buffer. The handle must have GENERIC_READ access.

lpcNumberOfEvents

Points to a 32-bit variable that receives the number of unread input records in the console s input buffer.

 

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError11C2VS7.

Remarks

The GetNumberOfConsoleInputEvents function reports the total number of unread input records in the input buffer, including keyboard, mouse, and window-resizing input records. Processes using the ReadFileCJND8P or ReadConsole4Z7F5N function can only read keyboard input. Processes using the ReadConsoleInput1OJP.D function can read all types of input records.

A process can specify a console input buffer handle in one of the wait functionsY2TC_3 to determine when there is unread console input. When the input buffer is not empty, the state of a console input buffer handle is signaled.

To read input records from a console input buffer without affecting the number of unread records, use the PeekConsoleInput10V_CGQ function. To discard all unread records in a console s input buffer, use the FlushConsoleInputBufferY_G9AG function.

See Also

FlushConsoleInputBuffer, PeekConsoleInput, ReadConsole, ReadConsoleInput, ReadFile