This documentation is archived and is not being maintained.

ServiceController.WaitForStatus Method (ServiceControllerStatus, TimeSpan)

.NET Framework 1.1

Waits for the service to reach the specified status or for the specified time-out to expire.

[Visual Basic]
Overloads Public Sub WaitForStatus( _
   ByVal desiredStatus As ServiceControllerStatus, _
   ByVal timeout As TimeSpan _
)
[C#]
public void WaitForStatus(
 ServiceControllerStatus desiredStatus,
 TimeSpan timeout
);
[C++]
public: void WaitForStatus(
 ServiceControllerStatus desiredStatus,
 TimeSpan timeout
);
[JScript]
public function WaitForStatus(
   desiredStatus : ServiceControllerStatus,
 timeout : TimeSpan
);

Parameters

desiredStatus
The status to wait for.
timeout
The amount of time to wait for the service to reach the specified status.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The desiredStatus parameter is not any of the values defined in the ServiceControllerStatus enumeration.
TimeoutException The value specified for the timeout parameter expires.

Remarks

Use WaitForStatus to suspend an application's processing until the service has reached the required status.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ServiceController Class | ServiceController Members | System.ServiceProcess Namespace | ServiceController.WaitForStatus Overload List | Status

Show: