要么试试CreateProcess
function CreateProcessAndWait(const AppPath, AppParams: String;
                              Visibility: word): DWord;
var
  SI: TStartupInfo;
  PI: TProcessInformation;
  Proc: THandle;
begin
  FillChar(SI, SizeOf(SI), 0);
  SI.cb := SizeOf(SI);
  SI.wShowWindow := Visibility;
  if not CreateProcess(PChar(AppPath), PChar(AppParams), Nil, Nil, False,
                   Normal_Priority_Class, Nil, Nil, SI, PI) then
    raise EExecuteError.CreateFmt('Failed to execute program.  Error Code %d',
                                  [GetLastError]);
  Proc := PI.hProcess;
  CloseHandle(PI.hThread);
  if WaitForSingleObject(Proc, Infinite) <> Wait_Failed then
    GetExitCodeProcess(Proc, Result);
  CloseHandle(Proc);
end;

解决方案 »

  1.   

    谢谢,能否来点解说之类的,或者,帮我介绍一本进程的详细点的书。
    我现在用的是《VC6技术内幕》的砖头。有没有DELPHI的书?或有调用的
    例程的书。
      

  2.   

    我看的是Delphi X(2/4/5/6) Developer's Guide,这段代码就是书上的例程。
      

  3.   

    Delphi X(2/4/5/6) Developer's Guide
    有中文的吗?在那里有呢?我现在手中什么都没有……
      

  4.   

    WinExec是16位或以前的Windows用的
    CreateProcess是专为以后的Windows用的,等于WinExec的升级版本
    还有ShellExecute是打开文件(用和这文件相连的打开方式)或直接运行程序
    听说快出 DDG6 了, 是不是真的?
      

  5.   

    四个红星星的大侠,能否告诉我,在什么地方有啊?
    可以发到我的E-MAIL吗:
    [email protected]
    小弟这里不胜感激。