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