I'm Pretty sure it's the Terminate Process API, I'll check MSDN.
Yes it is. You have to use the GetExitCodeProcess API to get an Exit Code
GetExitCodeProcess takes a byref Long as it's second Parameter. For Example
Code:Dim hWnd As Long Dim hProcess As Long Dim lngExitCode As Long Dim lngProcessId As Long 'Pretend hWnd is already a Window in the Process You want to close 'Get Process ID Call GetWindowThreadProcess(hWnd, lngProcessID) 'Get Process Handle hProcess = OpenProcess(PROCESS_TERMINATE,0,lngProcessID) 'Get Exit Code Call GetExitCodeProcess(hProcess,lngExitCode) 'Terminate Process Call ExitProcess(hProcess, lngExitCode) 'Close The Process Handle Call CloseHandle(hProcess)
And You Need the Folowing Declarations
Code:Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function OpenProcess Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" Alias "GetExitCodeProcess" (ByVal hProcess As Long, lpExitCode As Long) As Long Private Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As Long Const PROCESS_TERMINATE = 1
I'm pretty sure that'll all work




Reply With Quote