请问如何打开一个进程,或者关闭一个进程呢....(20分)

  • 主题发起人 主题发起人 dream0
  • 开始时间 开始时间
D

dream0

Unregistered / Unconfirmed
GUEST, unregistred user!
打个比方,本人现在要打开. "HTTP://WWW.HAO123.COM"这个网站,如果用shellexecute就会弹出一个IE,并打开HTTP://WWW.HAO123.COM,但是我如何关闭刚才弹出的窗口呢
 
FindWindow查找IE窗口。<br>SendMesssage(Ie_Handle,WM_Close,0,0)发送消息关闭他。
 
ShellExecute打开IE返回的是句柄嘛?
 
//结束进程<br>procedure Tfrmmain.EndProcess(AFileName: string);<br>const<br> &nbsp; PROCESS_TERMINATE = $0001;<br>var<br> &nbsp; ContinueLoop: BOOL;<br> &nbsp; FSnapShotHandle: THandle;<br> &nbsp; FProcessEntry32: TProcessEntry32;<br>begin<br> &nbsp; FSnapShotHandle := CreateToolhelp32SnapShot(TH32CS_SNAPPROCESS, 0);<br> &nbsp; FProcessEntry32.dwSize := SizeOf(FProcessEntry32);<br> &nbsp; ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);<br> &nbsp; while integer(ContinueLoop) &lt;&gt; 0 do<br> &nbsp; begin<br> &nbsp; &nbsp; &nbsp;if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =UpperCase(AFileName))<br> &nbsp; &nbsp; &nbsp; &nbsp; or (UpperCase(FProcessEntry32.szExeFile ) =UpperCase(AFileName))) then<br> &nbsp; &nbsp; &nbsp;TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),<br> &nbsp; &nbsp; &nbsp;FProcessEntry32.th32ProcessID), 0);<br> &nbsp; &nbsp; &nbsp;ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);<br> &nbsp; end;<br>end;
 
closeHandle(HWND);
 
后退
顶部