This documentation is archived and is not being maintained.

Process.WaitForInputIdle Method ()

Causes the Process component to wait indefinitely for the associated process to enter an idle state. This overload applies only to processes with a user interface and, therefore, a message loop.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public bool WaitForInputIdle ()
public boolean WaitForInputIdle ()
public function WaitForInputIdle () : boolean
Not applicable.

Return Value

true if the associated process has reached an idle state; otherwise, false.

Use WaitForInputIdle to force the processing of your application to wait until the message loop has returned to the idle state. When a process with a user interface is executing, its message loop executes every time a Windows message is sent to the process by the operating system. The process then returns to the message loop. A process is said to be in an idle state when it is waiting for messages inside of a message loop. This state is useful, for example, when your application needs to wait for a starting process to finish creating its main window before the application communicates with that window.

If a process does not have a message loop, WaitForInputIdle immediately returns false.

The WaitForInputIdle overload instructs the Process component to wait indefinitely for the process to become idle in the message loop. This instruction can cause an application to stop responding. For example, if the process is written to always exit its message loop immediately, as in the code fragment while(true).

  • LinkDemand  for full trust for the immediate caller. This member cannot be used by partially trusted code.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0