Ver Mensaje Individual
  #5  
Antiguo 25-05-2012
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 29
Lepe Va por buen camino
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 [-]
// devuelve 0 si todo ha ido bien, o GetLastError en caso contrario.
function RunAndWait(   Handle:THandle;
                            Ejecutable,
                            Argumentos:string;
                            const RunDirectory:PChar  =nil;
                            const Visibilidad:Integer = sw_shownormal):dword;
var
   Info:TShellExecuteInfo;
   pInfo:PShellExecuteInfo;
   ExitCodeWORD;
begin
   {Puntero a Info}
   {Pointer to Info}
   pInfo:=@Info;
   {Rellenamos Info}
   {Fill info}
   with Info do
   begin
    cbSize:=SizeOf(Info);
    fMask:=SEE_MASK_NOCLOSEPROCESS;
    wnd:=Handle;
    lpVerb:=nil;
    lpFile:=PChar(Ejecutable);
    {Parametros al ejecutable}
    {Executable parameters}
    lpParameters:=Pchar(Argumentos+#0);
    if RunDirectory = '' then
      lpDirectory:=nil
    else
      lpDirectory:= PChar(RunDirectory+#0);
    nShow:=Visibilidad;
    hInstApp:=0;
   end;
   {Ejecutamos}
   {Execute}
   if not ShellExecuteEx(pInfo) then
    Result:= GetLastError
   else
    Result := Info.hInstApp;

   {Esperamos que termine}
   {Wait to finish}
   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; //interface

implementation

uses
  NKPaths, IniFiles, Masks;
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita