Ver Mensaje Individual
  #4  
Antiguo 30-08-2013
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola juank1971.

No conozco ni he usado el PDFtoText, pero fijate si te sirve de este modo (o al menos te da alguna idea para continuar) :
Código Delphi [-]
...
uses ShellApi;

var
  ProcHandle : THandle = 0;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Enabled := False;
end;

procedure TForm1.ExecWithProgressBar(const AppName, Params: string);
var
  ExecInfo: TShellExecuteInfo;
begin
  ZeroMemory(@ExecInfo, SizeOf(ExecInfo));
  with ExecInfo do
  begin
    cbSize       := SizeOf(ExecInfo);
    fMask        := SEE_MASK_NOCLOSEPROCESS;
    Wnd          := ProcHandle;
    lpVerb       := 'open';
    lpFile       := PChar(AppName);
    lpParameters := PChar(Params);
    nShow        := SW_HIDE;
  end;
  if not ShellExecuteEx(@ExecInfo) then
    MessageBox(Handle,PChar(SysErrorMessage(GetLastError)),'',MB_ICONERROR+MB_OK)
  else
  begin
    ProcHandle := ExecInfo.hProcess;
    Timer1.Enabled := True;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  ExitCode: DWORD;
begin
  ProgressBar1.StepIt;
  if GetExitCodeProcess(ProcHandle, ExitCode) then
  begin
    if not (ExitCode = STILL_ACTIVE) then
    begin
      CloseHandle(ProcHandle);
      ProcHandle := 0;
    end
    else
      MessageBox(Handle,PChar(SysErrorMessage(GetLastError)),'',MB_ICONERROR+MB_OK);
    Timer1.Enabled := False;
   end;
end;
...


Ejemplo de llamada (imprimir un documento .pdf con PDFCreator):
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  ExecWithProgressBar('C:\Program Files\PDFCreator\PDFCreator.exe',
    '/NoStart/PFC:\Users\xxxx\Documents\Un_Documento.pdf');

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 30-08-2013 a las 22:09:29. Razón: aclaración
Responder Con Cita