关闭程序TaskManager Process时执行代码

时间:2014-03-14 19:21:21

标签: vb.net taskmanager

我作为一个人如何使用" TaskManager>处理"和"结束进程",它会关闭另一个程序,所以将两个程序关在一起。

我试过了

Private Sub frmAH_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
    If e.CloseReason = CloseReason.UserClosing Then
        Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("CabalMain")
        For Each p As Process In pProcess
            p.Kill()
        Next
        End
    End If
End Sub

然而,当你关闭游戏GameGuard时它并没有关闭,想要一起关闭游戏。

0 个答案:

没有答案