A
AKang
Unregistered / Unconfirmed
GUEST, unregistred user!
程序段如下:<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> myHwnd:THandle;<br> ProID:^Integer;<br> myHandle:THandle;<br>begin<br> myHwnd:=FindWindow(Nil,'Age of Empires II');<br> //得到窗口句柄<br> //showmessage(format('%x',[myHwnd]));<br> New(ProID);<br> GetWindowThreadProcessID(MyHwnd,ProID);<br> //得到进程ID<br> //ShowMessage(format('%x',[ProID^]));<br> myHandle:=OpenProcess(Process_All_Access,false,ProID^);<br> //得到进程句柄<br> //SHowMessage(Format('%x',[myHandle]));<br> if myHandle=$24 then<br> TerminateProcess(myHandle,0);<br>end;<br>疑问如下:<br>1.不管我找的是哪个程序,得到的myHandle都等于$1C,但如果再按一下Button1,就会加$4,再按再加<br>2.但是不管我在myHandle等于任何值,用TerminateProcess都可关闭它。<br><br>请各位高手赐教。<br><br>