WaitForInputIdle

  DWORD WaitForInputIdle(hProcess, dwTimeout)    
  HANDLE hProcess; /* process to wait for */
  DWORD dwTimeout; /* timeout time in milliseconds */

The WaitForInputIdle function waits until the specified process has no pending user input.

Parameters

hProcess

Identifies the process to wait for.

dwTimeout

Specifies the timeout time (in milliseconds). If dwTimeout is INFINITE, the function will not return until the process is idle.

Return Value

The following list shows the possible return values:

Value Meaning

0 The wait was satisfied successfully.
WAIT_TIMEOUT The wait was terminated because the timeout time was reached.
0xFFFFFFFF An error occurred. Use the GetLastError function to obtain extended error information.

Comments

The WaitForInputIdle function can be used at any time, not just during application startup.