当然有,使用FindWindow得到你运行的窗体的Handle,然后检测这个Handle是否关闭就可以了。查查FindWindow的使用方法。

解决方案 »

  1.   

    用CreateProcess
    WaitForInputIdle完全可以达到你的要求
      

  2.   

    function ProcessExecute(CommandLine: TCommandLine; cShow: Word): Integer;
    var
      Rslt: LongBool;
      StartUpInfo: TStartUpInfo;
      ProcessInfo: TProcessInformation;PROCESS_INFORMATION
    begin
      FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
      with StartupInfo do
      begin
        cb := SizeOf(TStartupInfo);
        dwFlags := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
        wShowWindow := cShow
      end;
      Rslt := CreateProcess(PChar(CommandLine), nil, nil, nil, False,
        NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
      if Rslt then
        with ProcessInfo do
        begin
          WaitForInputIdle(hProcess, INFINITE);//一直等待,直到进程完全启动
          CloseHandle(hThread); 
          CloseHandle(hProcess
          Result := 0;
        end
      else Result := GetLastError;
    end;