给你一个function<br>function WinExecAndWait32(FileName: string; Visibility: integer): Cardinal;<br>var<br> zAppName: array[0..512] of char;<br> zCurDir: array[0..255] of char;<br> WorkDir: string;<br> StartupInfo: TStartupInfo;<br> ProcessInfo: TProcessInformation;<br>begin<br> StrPCopy(zAppName, FileName);<br> GetDir(0, WorkDir);<br> StrPCopy(zCurDir, WorkDir);<br> FillChar(StartupInfo, Sizeof(StartupInfo), #0);<br> StartupInfo.cb := Sizeof(StartupInfo);<br> StartupInfo.dwFlags := STARTF_USESHOWWINDOW;<br> StartupInfo.wShowWindow := Visibility;<br> if not CreateProcess(nil, zAppName, nil, nil, true,<br> CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,<br> nil, nil, StartupInfo, ProcessInfo) then<br> Result := INFINITE<br> else begin<br> WaitforSingleObject(ProcessInfo.hProcess, INFINITE);<br> GetExitCodeProcess(ProcessInfo.hProcess, Result);<br> CloseHandle(ProcessInfo.hProcess);<br> CloseHandle(ProcessInfo.hThread);<br> end;<br>end;<br><br>例子:<br>WinExecAndWait32('RegEdit.exe', SW_Show);//当Regedit退出后才会执行下面的语句<br>.................