ªð¦^¦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 : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD