这个你也许用得上
Q:  How to execute a program and wait till it finishes (WIN 32).A:  function ProcessFG(const Filename, Arguments: String;
      const WindowState: Word): Boolean;    var
      StartUpInformation : TStartupInfo; 
      ProcessInformation : TProcessInformation;
      CommandLine        : String;    begin      // build command line
      //
      CommandLine := Filename + ' ' + Arguments;      // initialize start up information
      //
      FillChar(StartUpInformation, SizeOf(TStartUpInfo), Chr(0));
      StartUpInformation.cb          := SizeOf(TStartUpInfo);
      StartUpInformation.dwFlags     := STARTF_USESHOWWINDOW;
      StartUpInformation.wShowWindow := WindowState;      // spawn process
      //
      Result := CreateProcess(nil, PChar(CommandLine),
        nil, nil, FALSE, 
        CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, 
        PChar(ExtractFilePath(Filename)), StartUpInformation,
        ProcessInformation);      // wait for process to finish if created
      //
      if Result then WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
    end;