<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> sCommandLine: string;<br> bCreateProcess: boolean;<br> lpStartupInfo: TStartupInfo;<br> lpProcessInformation: TProcessInformation;<br>begin<br> sCommandLine := 'D:/TEMP/TEST.EXE';<br> // 填? StartupInfo<br> FillChar(lpStartupInfo, Sizeof(TStartupInfo), #0);<br> lpStartupInfo.cb := Sizeof(TStartupInfo);<br> lpStartupInfo.dwFlags := STARTF_USESHOWWINDOW;<br> lpStartupInfo.wShowWindow := SW_NORMAL;<br><br> bCreateProcess := CreateProcess(nil, PChar(sCommandLine),<br> nil, nil, True, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,<br> nil, nil, lpStartupInfo, lpProcessInformation);<br> if bCreateProcess then //等外部进程的结束<br> WaitForSingleObject(lpProcessInformation.hProcess, INFINITE);<br>end;<br>