Hi,
I'm using the code below to kill a process on my local machine by passing it the PID. I would like to terminate a process on another machine using the computer name. Is there a way to specify computer name somewhere? (I do have administrative rights on the other machine)
Thanks in advance,
TN
I'm using the code below to kill a process on my local machine by passing it the PID. I would like to terminate a process on another machine using the computer name. Is there a way to specify computer name somewhere? (I do have administrative rights on the other machine)
Thanks in advance,
TN
Code:
Private Declare Function OpenProcess Lib "kernel32" (ByVal _
dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" _
(ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Const PROCESS_TERMINATE As Long = &H1
Private Sub Command1_Click()
Dim ProcHandle As Long
Dim PID As Int
ProcHandle = OpenProcess(PROCESS_TERMINATE, False, CLng(PID))
TerminateProcess ProcHandle, 0
CloseHandle ProcHandle
End Sub