我想在一个过程中 按以下步骤执行
第一步定义变量
第二步 调用外部的exe程序 等exe程序结束了
执行第三步 。。。。
我知道怎样实现 第三步等待 我把第二步中的exe关闭 在来执行
主要是朋友要做一个接口 中间调用 别人的exe 如果调用然后处理完了 在继续执行
try this:
function ExecAppWait(AppName, Params: string): Boolean;
var
ShellExInfo: TShellExecuteInfo;
begin
FillChar(ShellExInfo, SizeOf(ShellExInfo), 0);
with ShellExInfo do
begin
cbSize := SizeOf(ShellExInfo);
fMask := see_Mask_NoCloseProcess;
Wnd := Application.Handle;
lpVerb := 'open';
lpFile := PChar(AppName);
//lpParameters := PChar(Params);
lpDirectory := PChar(Params);
nShow := sw_hide;
end;
Result := ShellExecuteEx(@ShellExInfo);
if Result then
while WaitForSingleObject(ShellExInfo.HProcess, 100) = WAIT_TIMEOUT do
begin
Application.ProcessMessages;
if Application.Terminated then Break;
end;
end;
call func:
ExecAppWait(exeName, operatorFile);
第一步定义变量
第二步 调用外部的exe程序 等exe程序结束了
执行第三步 。。。。
我知道怎样实现 第三步等待 我把第二步中的exe关闭 在来执行
主要是朋友要做一个接口 中间调用 别人的exe 如果调用然后处理完了 在继续执行
try this:
function ExecAppWait(AppName, Params: string): Boolean;
var
ShellExInfo: TShellExecuteInfo;
begin
FillChar(ShellExInfo, SizeOf(ShellExInfo), 0);
with ShellExInfo do
begin
cbSize := SizeOf(ShellExInfo);
fMask := see_Mask_NoCloseProcess;
Wnd := Application.Handle;
lpVerb := 'open';
lpFile := PChar(AppName);
//lpParameters := PChar(Params);
lpDirectory := PChar(Params);
nShow := sw_hide;
end;
Result := ShellExecuteEx(@ShellExInfo);
if Result then
while WaitForSingleObject(ShellExInfo.HProcess, 100) = WAIT_TIMEOUT do
begin
Application.ProcessMessages;
if Application.Terminated then Break;
end;
end;
call func:
ExecAppWait(exeName, operatorFile);