精華區beta Programming 關於我們 聯絡資訊
我們以 Delphi 的語法來說明: function RunShell(asCmdLine: string): Word; var pi: TProcessInformation; si: TStartupInfo; bRet: Boolean; dwRet: DWORD; begin FillChar(si, SizeOf(TStartupInfo), 0); si.cb := SizeOf(TStartupInfo); si.wShowWindow := SW_SHOWNORMAL; bRet := CreateProcess(nil, PChar(asCmdLine), nil, nil, False, 0, nil, nil, si, pi); if not bRet then begin ShowErrorMessage; Result := 0 ; Exit; end; { wait until the process terminate} repeat Application.ProcessMessages; bRet := GetExitCodeProcess(pi.hProcess, dwRet); if not bRet then begin ShowErrorMessage; Result := 0 ; Exit; end; until dwRet <> STILL_ACTIVE; Result := 1 ; end; ================================= PQ(Perfect & Quick)軟體工作室 e-mail: lancerol@ms18.hinet.net Tel: 02-27592243 Mr.張 Pager: 0945562037 URL: http://www.taconet.com.tw/pq =================================