资 源 简 介
program TerminateProcess {$APPTYPE CONSOLE} uses SysUtils, Windows var ProcessHwnd, WindowHwnd: THandle ProcessID: DWORD begin //得到记事本的主窗口句柄 WindowHwnd := FindWindow( Notepad , nil) if not isWindow(WindowHwnd) then ExitProcess(0) //得到记事本的进程标识 GetWindowThreadProcessId(WindowHwnd, ProcessID) if ProcessID = 0 then ExitProcess(0) //根据进程标识打开进程句柄 ProcessHwnd := OpenProcess(PROCESS_ALL_ACCESS, false, ProcessID) if ProcessHwnd = 0 then ExitProcess(0) //中止指定句柄的进程 Windows.TerminateProcess(ProcessHwnd, 0) end.-program (TerminateProcess $ APPTYPE CONSOLE) uses SysUtils, Windows var ProcessHwnd, WindowHwnd : THandle ProcessID : DWORD begin// notebook to be the main window handle WindowHwnd : = FindWindow (Notepad, nil) if not isWindow (WindowHwnd) then ExitProcess (0)// notebook to be in the process logo GetWindowThreadProcessId (WindowHwnd, ProcessID) if ProcessID = 0 then ExitProcess (0)// identification process under the process opened handle ProcessHwnd : = OpenProcess (PROCESS_ALL_ACCESS, fals