//执行文件并等待其结束
if CreateProcess(nil,pchar(SysPath+'/XXXXX.exe'),nil,nil,false,
create_new_console or normal_priority_class,nil,nil,startupinfo,processinfo) then
begin
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
//Do something during ....
end; //到此程序结束,可以在这里让另一个程序运行......