# Function Reference

# _WinAPI_WaitForInputIdle

Waits until a process is waiting for user input with no input pending, or a time out

#include <WinAPIProc.au3>
_WinAPI_WaitForInputIdle ( $hProcess [, $iTimeout = -1] )

## Parameters

$hProcess | A handle to the process. If this process is a console application or does not have a message queue, this function returns immediately.
$iTimeOut | [optional] The time out interval, in milliseconds. If set to -1, the function does not return until the process is idle.

## Return Value

Success: | True
Failure: | False

## Remarks

This function causes a thread to suspend execution until the specified process has finished its initialization
and is waiting for user input with no input pending. This can be useful for synchronizing a parent process and
a newly created child process. When a parent process creates a child process, the CreateProcess function
returns without waiting for the child process to finish its initialization. Before trying to communicate with
the child process, the parent process can use this function to determine when the child's initialization has
been completed. This function can be used at any time, not just during application startup.

## See Also

Search WaitForInputIdle in MSDN Library.