Y yanghx_yhx Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-06 #1 wind2000 你说的方法至可以关闭一个可见的窗口.<br>但是,我的问题是如何关闭进程?<br>此进程是由于在delphi程序中隐含调用pkunzip,exe而产生的<br>调用语句是:winexec(pchar('pkunzip.exe'),SW_show));<br>请尽快得以解决
wind2000 你说的方法至可以关闭一个可见的窗口.<br>但是,我的问题是如何关闭进程?<br>此进程是由于在delphi程序中隐含调用pkunzip,exe而产生的<br>调用语句是:winexec(pchar('pkunzip.exe'),SW_show));<br>请尽快得以解决
B Brave Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-06 #2 找到该程序的句柄,然后发给他一个结束的消息<br>或则记住调用时候的句柄
Z zhangkan Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-06 #5 function EnumWindowsProc(HWND:hWnd;paramointer): Boolean; stdcall;<br><br>var WinChar:array[0..255] of char;<br> CloseHandle:HWND;<br><br>function EnumWindowsProc(HWND: hWnd; paramointer): Boolean;<br>var buffer:array[0..255] of Char;<br>begin<br> GetWindowText(hWnd,buffer,256);<br> if (Length(string(buffer))>0) then<br> begin<br> StrCopy(WinChar,buffer);<br> if WinChar='YouApplication' then//这儿写上你想要关闭的进程的名称.<br> begin<br> CloseHandle:=hWnd;<br> exit;<br> end;<br> end;<br> Result:=True;<br>end;<br><br> EnumWindows(@EnumWindowsProc,0);//调用<br><br> PostMessage(CloseHandle,WM_CLOSE,0,0);//关闭此进程<br>大致是这样,你试试看.
function EnumWindowsProc(HWND:hWnd;paramointer): Boolean; stdcall;<br><br>var WinChar:array[0..255] of char;<br> CloseHandle:HWND;<br><br>function EnumWindowsProc(HWND: hWnd; paramointer): Boolean;<br>var buffer:array[0..255] of Char;<br>begin<br> GetWindowText(hWnd,buffer,256);<br> if (Length(string(buffer))>0) then<br> begin<br> StrCopy(WinChar,buffer);<br> if WinChar='YouApplication' then//这儿写上你想要关闭的进程的名称.<br> begin<br> CloseHandle:=hWnd;<br> exit;<br> end;<br> end;<br> Result:=True;<br>end;<br><br> EnumWindows(@EnumWindowsProc,0);//调用<br><br> PostMessage(CloseHandle,WM_CLOSE,0,0);//关闭此进程<br>大致是这样,你试试看.
H huiyugan Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-14 #8 用CreateProcess,不要用WinExec