線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2478
推到 Plurk!
推到 Facebook!

WinAPI監控.exe執行檔的函式

答題得分者是:pcboy
rockman326
一般會員


發表:6
回覆:2
積分:1
註冊:2007-02-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-03-06 15:21:43 IP:59.127.xxx.xxx 訂閱
請問在WinAPI的函式中有無監控.exe檔的函式,假設我在delphi中用Button
做了一個開啟記事本的功能,用了一個Label顯示記事本有無被關閉,請問我
怎麼監控記事本的狀態
pcboy
版主


發表:177
回覆:1838
積分:1463
註冊:2004-01-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-03-06 16:10:41 IP:210.241.xxx.xxx 訂閱
搜尋所有執行中的程式, 看看有無稱為 notepad.exe 的
[發表] 顯示目前執行的程序(Process List) (含Source Code)
http://delphi.ktop.com.tw/board.php?cid=31&fid=79&tid=86821

------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!

子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-03-06 16:33:31 IP:59.124.xxx.xxx 未訂閱
請參考以下範例並自行修改:
<textarea class="vb" rows="10" cols="60" name="code"> uses ShellAPI procedure TForm1.Button1Click(Sender: TObject); var SEInfo: TShellExecuteInfo; ExitCode: DWORD; ExecuteFile, ParamString, StartInString: string; begin ExecuteFile:='c:\WinNT\system32\Calc.exe'; FillChar(SEInfo, SizeOf(SEInfo), 0) ; SEInfo.cbSize := SizeOf(TShellExecuteInfo) ; with SEInfo do begin fMask := SEE_MASK_NOCLOSEPROCESS; Wnd := Application.Handle; lpFile := PChar(ExecuteFile) ; { ParamString can contain the application parameters. } // lpParameters := PChar(ParamString) ; { StartInString specifies the name of the working directory. If ommited, the current directory is used. } // lpDirectory := PChar(StartInString) ; nShow := SW_SHOWNORMAL; end; if ShellExecuteEx(@SEInfo) then begin repeat Application.ProcessMessages; GetExitCodeProcess(SEInfo.hProcess, ExitCode) ; until (ExitCode <> STILL_ACTIVE) or Application.Terminated; ShowMessage('Calculator terminated') ; end else ShowMessage('Error starting Calc!') ; end; </textarea>



Fishman
------
Fishman
系統時間:2024-04-20 3:32:03
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!