Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Acrobat PDF GotFocus Error

Status
Not open for further replies.

Nro

Programmer
May 15, 2001
337
CA
Hello.

I open an Acrobat document (PDF) from VFP 9.0. Here some code;

Code:
LPARAMETERS tcPdfFile AS String
DECLARE INTEGER ShellExecute IN shell32.dll ;
 INTEGER hndWin, ;
 STRING cAction, ;
 STRING cFileName, ;
 STRING cParams, ;
 STRING cDir, ;
 INTEGER nShowWin

* /h : Start Minimized
* /t : no acrobat window

lcParam = '/h /t "' + tcPdfFile + '"'
lnErrCode = ShellExecute(0, "open", "AcroRd32.exe", lcParam, "", 0)

Everything work, the Acrobat window is shown, and the user can zoom in and out and flip thru pages, etc. When he clicks to the printer button, Acrobat shows the printing dialog, he clicks OK or CANCEL, and I received this OLE message.


Code:
Error #: 1426
Message : OLE error code 0x80004005 : unspecified error.
Method : _frmAcrobatViewer._olepdf.GotFocus

Foxpro crash, and I have to close it with task manager.
Is there a way to hide the printing button (I have another routine to print the PDF), or to track this message?

Thanks in advance.

Nro
 
Nro,

Is there a way to hide the printing button ... or to track this message?

Not from within FoxPro.

When you use ShellExecute(), you are handing control to whatever program you are executing. VFP doesn't know anything about what the program is or how it works.

If the Actrobat viewer isn't doing what you want, look for support for that product. It has nothing to do with VFP.

Or, look for a different PDF viewer. Acrobat isn't the only show in town. For example, Foxit is a third-party viewer that might meet your requirements.

Going further, if you modify your code as follows:

Code:
lnErrCode = ShellExecute(0, "open", tcPdfFile, "", "", 0)

then that will automatically open whichever PDF viewer your user has installed.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top