[VB] 프로세스 제거하기

VB 2015. 5. 24. 09:00

■ 프로세스 제거하기

----------------------------------------------------------------------------------------------------

Private Function KillProcess(strProcess As String)

   

    Dim pService   As Object

    Dim pObjectSet As Object

    Dim pObject    As Object

    

    Set pService = GetObject("winmgmts:")

    

    Set pObjectSet = pService.ExecQuery("SELECT * FROM win32_process")

    

    For Each pObject In pObjectSet

    

        DoEvents

        

        If LCase(pObject.Name) = strProcess Then

        

            pObject.Terminate

            

            Exit For

            

        End If

        

    Next

 

End Function

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요