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

ShellExecute 程式間呼叫如何使用

 
css
一般會員


發表:24
回覆:17
積分:8
註冊:2006-08-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-10-02 23:45:55 IP:220.132.xxx.xxx 未訂閱

main.exe 呼換 t1.exe or t2.exe ot t3.exe 時可以將 main.exe 隱藏或關畢嗎 ?

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(handle,PChar('open'),Pchar('C:\1\2\t1.EXE'),'ST',nil,SW_SHOWDEFAULT);
end;

等待 t1.exe close 時, 如何呼叫 main.exe ?

Fishman
尊榮會員


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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2006-10-04 16:18:02 IP:210.65.xxx.xxx 未訂閱

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;

Fishman

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