Méthode Shell.IsServiceRunning

Retourne une valeur qui indique si un service particulier est en cours d’exécution.

Syntaxe

retVal = Shell.IsServiceRunning(
  sServiceName
)

Shell.IsServiceRunning( _
  ByVal sServiceName As BSTR _
) As Variant

Paramètres

sServiceName [in]

Type : BSTR

Chaîne qui contient le nom du service.

Valeur retournée

JScript

Type : Variant*

Retourne true si le service spécifié par sServiceName est en cours d’exécution ; sinon, false.

VB

Type : Variant*

Retourne true si le service spécifié par sServiceName est en cours d’exécution ; sinon, false.

Notes

Cette méthode n’est actuellement pas disponible dans Microsoft Visual Basic.

Exemples

Les exemples suivants montrent l’utilisation de IsServiceRunning pour déterminer si le service Themes s’exécute pour une application. L’utilisation est indiquée pour JScript et 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

Spécifications

Condition requise Valeur
Client minimal pris en charge
Windows 2000 Professionnel, Windows XP [applications de bureau uniquement]
Serveur minimal pris en charge
Windows Server 2003 [applications de bureau uniquement]
En-tête
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 5.0 ou ultérieure)