var sInfo : TStartupInfo;
pInfo : TProcessInformation;
cmdLine : String;
exitCode : Cardinal;
// 下面是调用过程
cmdLine := 'c:/winnt/notepad.exe';
FillChar(sInfo,sizeof(sInfo),#0);
sInfo.cb := SizeOf(sInfo);
sInfo.dwFlags := STARTF_USESHOWWINDOW;
sInfo.wShowWindow := SW_NORMAL;
if not CreateProcess(nil,pchar(cmdLine),nil,nil,false,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, sInfo, pInfo) then
MessageBox(Application.handle,'指定程序启动失败!','错误',MB_OK or MB_ICONSTOP)
else
begin
WaitForSingleObject(pInfo.hProcess,INFINITE);
GetExitCodeProcess(pInfo.hProcess,exitCode);
end;