如何拦截指定的程序运行?
在VB2005中可以实现吗?
[解决办法]
比如拦截Excel
Dim processlist() As Process = Process.GetProcesses()
For Each kp As Process In processlist
If kp.ProcessName = "Excel " Then
kp.Kill()
End If
Next
[解决办法]
Dim q As New Management.EventQuery( "SELECT * FROM Win32_ProcessStartTrace ")
WithEvents w As New Management.ManagementEventWatcher(q)
Sub Start()
w.Start()
End Sub
Private Sub w_EventArrived(ByVal sender As Object, ByVal e As System.Management.EventArrivedEventArgs) Handles w.EventArrived
e.NewEvent '这就是新创建的进程的对象,如何使用请在网上找WMI + Win32_Process
End Sub