Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
IShellDispatch2
Methods
 IsServiceRunning Method

  Switch on low bandwidth view
IsServiceRunning Method

Returns a value that indicates whether a named service is running.

Syntax

bIsRunning = IShellDispatch2.IsServiceRunning(sServiceName)

Parameters

sServiceName Required. A String that contains the service's name.

Return Value

Variant. Returns true if the service specified by sServiceName is running, or false otherwise.

Remarks

This method is not currently available in Microsoft Visual Basic.

Examples

The following example uses IsServiceRunning to determine whether the Themes service is running for a particular application. Proper usage is shown for Microsoft JScript and Visual Basic Scripting Edition (VBScript).

JScript:

function fnIsServiceRunningJ()
{
    var objShell = new ActiveXObject("Shell.Application");
    var bReturn;

    bReturn = objShell.IsServiceRunning("Themes");
}

VBScript:

function fnIsServiceRunningVB()
    dim objShell
    dim bReturn

    set objShell = CreateObject("Shell.Application")
         bReturn = objShell.IsServiceRunning("Themes")
    set objShell = nothing
end function

Applies To

IShellDispatch2
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker