본문 바로가기

자료

[C# / vb.net] Kill Process

728x90
Public Function KillProcess(app_exe_Name As String) As Integer

    Try

        Dim Process As Object, i As Integer

        For Each Process In GetObject("winmgmts:").ExecQuery("Select * from Win32_Process Where Name = '" & app_exe_Name & "'")

            i += 1

            Process.Terminate()

        Next

        Return i

    Catch ex As Exception

        Return 0

    End Try

End Function
728x90