procedure TForm1.Button1Click(Sender: TObject);
var
myHwnd:THandle;
ProID:^Integer;
myHandle:THandle;
begin
myHwnd:=FindWindow(Nil,'Age of Empires II'); //得到窗口句柄
New(ProID);
GetWindowThreadProcessID(MyHwnd,ProID); //得到进程ID
myHandle:=OpenProcess(Process_All_Access,false,ProID^); //得到进程句柄
if myHandle=$24 then
TerminateProcess(myHandle,0);
end;