W
wubo830814
Unregistered / Unconfirmed
GUEST, unregistred user!
帮我看一下这段代码,我想让外部程序执行完再向下执行,但是,没有控制住,在调用外部程序的时候就向下执行了,为什么?,是CreateProcess中的参数设置有问题吗
function TFormSoft.ExeWait(UnIn: String): Boolean;
//执行卸载并等待
var
SUInfo: TStartupInfo;
PRInfo: TProcessInformation;
begin
Result:=False;
FillChar(SUInfo, SizeOf(SUInfo), CHR(0));
SUInfo.cb:=SizeOf(SUInfo);
SUInfo.dwFlags:=STARTF_UsesTDHandles or STARTF_USESHOWWINDOW;
SUInfo.wShowWindow:=SW_SHOW;
Result:=CreateProcess(nil,PChar(UnIn),nil,nil,False,NORMAL_PRIORITY_CLASS,nil,nil,SUInfo,PRInfo);
if Result then
WaitForSingleObject(PRInfo.hProcess,INFINITE);
end;
function TFormSoft.ExeWait(UnIn: String): Boolean;
//执行卸载并等待
var
SUInfo: TStartupInfo;
PRInfo: TProcessInformation;
begin
Result:=False;
FillChar(SUInfo, SizeOf(SUInfo), CHR(0));
SUInfo.cb:=SizeOf(SUInfo);
SUInfo.dwFlags:=STARTF_UsesTDHandles or STARTF_USESHOWWINDOW;
SUInfo.wShowWindow:=SW_SHOW;
Result:=CreateProcess(nil,PChar(UnIn),nil,nil,False,NORMAL_PRIORITY_CLASS,nil,nil,SUInfo,PRInfo);
if Result then
WaitForSingleObject(PRInfo.hProcess,INFINITE);
end;