ªð¦^¦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 : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD