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