IWindowProvider::WaitForInputIdle Method

Causes the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first.


HRESULT WaitForInputIdle(          int milliseconds,
    BOOL *pRetVal


[in]  The amount of time, in milliseconds, to wait for the associated process to become idle. The maximum is Int32.MaxValue.
[out, retval] The address of a variable that receives TRUE if the window has entered the idle state; FALSE if the timeout occurred. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.


This method is typically used in conjunction with the handling of a WindowOpenedEvent (Window_WindowOpened_Event_GUID). The implementation is dependent on the underlying application framework; therefore this method might return some time after the window is ready for user input. The calling code should not rely on this method to ascertain exactly when the window has become idle. Use the value of pRetVal to determine if the window is ready for input or if the method timed out.

See Also

UI Automation Providers Overview

Community Additions