获取指定窗口句柄结束进程 OpenProcess FindWindow GetExitCodeprocess TerminateProcess

获取指定窗口句柄结束进程 OpenProcess FindWindow GetExitCodeprocess TerminateProcess

procedure TForm1.Button1Click(Sender: TObject); var wh:HWND; id:Cardinal; code:Cardinal; hp:THandle; begin wh:=FindWindow('txguifoundation',nil);//窗口QQ2009句柄 GetWindowThreadProcessId(wh,id);//得到进程ID hp:=OpenProcess(PROCESS_TERMINATE,False,id);//返回进程句柄 GetExitCodeProcess(hp,id);//得到退出码 TerminateProcess(hp,id); //结束进程 end; end. 

如何获取指定窗口句柄:http://blog.csdn.net/hellsb/archive/2010/10/07/5925944.aspx



你可能感兴趣的:(Delphi,7)