No me deja editar el mensaje anterior....
Ahora que tengo más tiempo...Aquí va la rutina de la mítica biblioteca NKLIb, archivo NKFiles:
Código Delphi
[-]
function RunAndWait( Handle:THandle;
Ejecutable,
Argumentos:string;
const RunDirectory:PChar =nil;
const Visibilidad:Integer = sw_shownormal):dword;
var
Info:TShellExecuteInfo;
pInfo:PShellExecuteInfo;
ExitCodeWORD;
begin
pInfo:=@Info;
with Info do
begin
cbSize:=SizeOf(Info);
fMask:=SEE_MASK_NOCLOSEPROCESS;
wnd:=Handle;
lpVerb:=nil;
lpFile:=PChar(Ejecutable);
lpParameters:=Pchar(Argumentos+#0);
if RunDirectory = '' then
lpDirectory:=nil
else
lpDirectory:= PChar(RunDirectory+#0);
nShow:=Visibilidad;
hInstApp:=0;
end;
if not ShellExecuteEx(pInfo) then
Result:= GetLastError
else
Result := Info.hInstApp;
repeat
ExitCode := WaitForSingleObject(Info.hProcess,500);
Application.ProcessMessages;
until (ExitCode <> WAIT_TIMEOUT);
end;
Los uses no los tengo claro, pero tiene todos estos:
Código Delphi
[-]
uses Windows, SysUtils, Classes, FileCtrl,shellapi,Forms,math;
implementation
uses
NKPaths, IniFiles, Masks;