procedure TForm1.Button1Click(Sender: TObject);<br>var<br>st:TStartUpInfo;<br>pp:TProcessInformation;<br>ppp:Thandle;<br>tt:Cardinal;<br>begin<br>FillChar(st,sizeof(st),#0);<br>with st do<br>begin<br> cb:=sizeof(st);<br> dwFlags:=StartF_UsesTDHandles or STARTF_USESHOWWINDOW;<br> lptitle:=nil;<br> wShowWindow:=SW_HIDE;<br>end;<br>CreateProcess(PChar('c:/program files/microsoft office/office/winword.exe'),<br> nil,nil,nil,true,DETACHED_PROCESS,nil,nil,st,pp);<br> ppp:=OpenProcess(PROCESS_ALL_ACCESS, FALSE,pp.dwProcessId );<br> GetExitCodeProcess(ppp,tt);<br> Exitprocess(tt)<br><br>// TerminateProcess(ppp,0);也可代替GetExitCodeProcess与ExitProcess<br>end;<br>