ªð¦^¦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¨Æ­n´£±o°_¡A¬O«D­n©ñ±o¤U¡A¦¨´N§O¤H§Y¬O¦¨´N¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD