ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] windowsªA°È °±¤î©Î±Ò°Ê

[¤À¨É] windowsªA°È °±¤î©Î±Ò°Ê

Private Sub AA_Click()
    If SwitchService("Messenger", True) Then
        MsgBox "OK !"
    End If
End Sub

Private Function SwitchService(strSvcName As String, blnOpen As Boolean) As Boolean
    Dim strWMIcls As String
    Dim objSvc As Object
   
    strWMIcls = "Win32_Service"
    Set objSvc = GetObject("winmgmts:").InstancesOf(strWMIcls)(strWMIcls & ".Name=""" & strSvcName & """")
    SwitchService = CallByName(objSvc, IIf(blnOpen, "StartService", "StopService"), 1) = 0
End Function

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD