Private Const PROCESS_TERMINATE = 1
'** Required APIs to terminate other functions.
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Sub Form_Load()
Dim MyPID As Long
Dim PIDToKill As Long
MyPID = Shell("C:\windows\notepad.exe")
PIDToKill = OpenProcess(PROCESS_TERMINATE, 0, MyPID)
KillRunningProgram = TerminateProcess(PIDToKill, 0)
End Sub