Checking for VPE dll

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Checking for VPE dll

Postby Brent Rose » Fri Jul 11, 2014 4:19 am

I'm looking at controlling the situation where my app runs without the VPE dll (eg vpep3261.dll) being present (XE5, VCL). Currently, it appears that simply having "VPE_VCL" in the uses clause of a form which is not auto-created (even if there is no TVPEngine component in the form) is enough to trigger the exception "Could not load VPE-DLL!" on application start-up. This appears to fire even before Application.Initialize. Subsequently, if an attempt is made to use a VPE feature (ie generate a report), an AV occurs.

I would rather my app trapped the error and advised the user what to do in more detail, allowing the app to run but blocking access to reporting features dependent on VPE, for example.

Is there any way to deal with this problem cleanly? Is it possible, for example, for VPE to NOT raise an exception at all, but set an error state and safely avoid subsequent AVs if a report is accessed etc...

Thanks.
Brent Rose
 
Posts: 50
Joined: Wed Mar 21, 2012 8:13 pm

Re: Checking for VPE dll

Postby IDEAL Software Support » Fri Jul 11, 2014 4:38 am

The vpengine.pas source code is responsible for loading the VPE DLL and binding the exported functions.

If you look at the "procedure InitializeVPE", the code calls LoadLibrary() to load the VPE DLL and checks its return code. If it is bad, the message box is displayed. You can easily modify this procedure and remove the message box. You can further check the global variable "DLLInitialized", which is false in case the VPE DLL could not be loaded.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Checking for VPE dll

Postby Brent Rose » Fri Jul 11, 2014 6:36 am

That's great - thanks!
Brent Rose
 
Posts: 50
Joined: Wed Mar 21, 2012 8:13 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 5 guests

cron