给你参考一下。另外我刚搞了个类似这样的软件。要的话EMAIL给你。
使用createprocess函数创建进程调用应用程序,同时使用waitforsignleobject等待进程结束。在此处理所给为32位版本。
function ExecAndWait(const Filename, Params: string; WindowState: word):
boolean;
var
SUInfo: TStartupInfo;
ProcInfo: TProcessInformation;
CmdLine: string;
begin
CmdLine:=filename+' '+params;
FillChar(SUInfo, SizeOf(SUInfo), #0);
with SUInfo do
begin
cb := SizeOf(SUInfo);
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := WindowState;
end;
Result := CreateProcess(NIL, PChar(CmdLine), NIL, NIL, FALSE,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, NIL,
PChar(ExtractFilePath(Filename)), SUInfo, ProcInfo);
if Result then
begin
//等待应用程序结束
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
//删除句柄
CloseHandle(ProcInfo.hProcess);
CloseHandle(ProcInfo.hThread);
end;
end;