Shell. IsServiceRunning, méthode
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 [ dans]
-
Type : BSTR
Chaîne qui contient le nom du service.
Valeur de retour
JScript
Type : variante *
Retourne la valeur true si le service spécifié par sServiceName est en cours d’exécution ; Sinon, false.
VB
Type : variante *
Retourne la valeur true si le service spécifié par sServiceName est en cours d’exécution ; Sinon, false.
Notes
Cette méthode n’est pas disponible actuellement dans Microsoft Visual Basic.
Exemples
Les exemples suivants illustrent l’utilisation de IsServiceRunning pour déterminer si le service themes est en cours d’exécution 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 Professional, Windows XP [ desktop apps uniquement] |
| Serveur minimal pris en charge |
Windows Serveur 2003 [ applications de bureau uniquement] |
| En-tête |
|
| MIDL |
|
| DLL |
|