高分!请求帮忙,急..........(100分)

  • 主题发起人 yanghx_yhx
  • 开始时间
Y

yanghx_yhx

Unregistered / Unconfirmed
GUEST, unregistred user!
wind2000 你说的方法至可以关闭一个可见的窗口.<br>但是,我的问题是如何关闭进程?<br>此进程是由于在delphi程序中隐含调用pkunzip,exe而产生的<br>调用语句是:winexec(pchar('pkunzip.exe'),SW_show));<br>请尽快得以解决
 
找到该程序的句柄,然后发给他一个结束的消息<br>或则记住调用时候的句柄
 
用什么方法可以找到此程序的句柄呢?<br>
 
winexec的返回值是不是?
 
function EnumWindowsProc(HWND:hWnd;param:pointer): Boolean; stdcall;<br><br>var WinChar:array[0..255] of char;<br>&nbsp; &nbsp; CloseHandle:HWND;<br><br>function EnumWindowsProc(HWND: hWnd; param:pointer): Boolean;<br>var buffer:array[0..255] of Char;<br>begin<br>&nbsp; GetWindowText(hWnd,buffer,256);<br>&nbsp; &nbsp;if (Length(string(buffer))&gt;0) then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; StrCopy(WinChar,buffer);<br>&nbsp; &nbsp; &nbsp; if WinChar='YouApplication' then//这儿写上你想要关闭的进程的名称.<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; CloseHandle:=hWnd;<br>&nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; Result:=True;<br>end;<br><br>&nbsp;EnumWindows(@EnumWindowsProc,0);//调用<br><br>&nbsp;PostMessage(CloseHandle,WM_CLOSE,0,0);//关闭此进程<br>大致是这样,你试试看.
 
winexec的返回值不是<br>
 
有现成的ZIP格式压缩解压控件
 
用CreateProcess,不要用WinExec
 
我有完整的程序。要不要。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
976
SUNSTONE的Delphi笔记
S
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
顶部