ªð¦^¦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 : Ä@­n¤j¡B§Ó­n°í¡B®ð­n¬X¡B¤ß­n²Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD