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

[µo°Ý] ¦p¦ó¥ÎVBAÃö³¬¥~³¡µ{¦¡

¥»©«³Ì«á¥Ñ quickfixer ©ó 2018-8-17 01:50 ½s¿è

¸Õ¬Ý¬Ý


Sub stopApp()
   
    Dim app As String
    Dim objWMI As Object, objProcess As Object, objList As Object
    Dim intError As Integer



    app = "calc.exe" '³o¸Ì¶ñ¤J­nÃö³¬ªº°õ¦æÀɦWºÙ


    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set objList = objWMI.ExecQuery("select * from win32_process where name='" & app & "'")
   
    For Each objProcess In objList
        intError = objProcess.Terminate
        If intError <> 0 Then Exit For
    Next

    Set objWMI = Nothing
    Set objList = Nothing
    Set objProcess = Nothing

End Sub

TOP

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD