IShellDispatch2.CanStartStopService method
Determines if the current user can start and stop the named service.
Syntax
retVal = IShellDispatch2.CanStartStopService(
sServiceName
)
IShellDispatch2.CanStartStopService( _
ByVal sServiceName As String _
) As Variant
Parameters
-
sServiceName [in]
-
Type: String
A String that contains the name of the service.
Return value
JScript
Type: Variant*
Returns true if the user can start and stop the service; otherwise, false.
VB
Type: Variant*
Returns true if the user can start and stop the service; otherwise, false.
Remarks
This method is implemented and accessed through the Shell.CanStartStopService method.
This method is not currently available in Microsoft Visual Basic.
Examples
The following examples show the usage of CanStartStopService for JScript and VBScript.
JScript:
<script language="JScript">
function fnCanStartStopServiceJ()
{
var objShell = new ActiveXObject("shell.application");
var bReturn;
bReturn = objShell.CanStartStopService("service name");
}
</script>
VBScript:
<script language="VBScript">
function fnCanStartStopServiceVB()
dim objShell
dim bReturn
set objShell = CreateObject("shell.application")
bReturn = objShell.CanStartStopService("service name")
set objShell = nothing
end function
</script>
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|
IDL |
|
DLL |
|