Waits until a process is waiting for user input with no input pending, or a time out
_WinAPI_WaitForInputIdle ( $hProcess [, $iTimeout = -1] )
|$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.
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.
Search WaitForInputIdle in MSDN Library.