DynaPDF Manual - Page 19

Previous Page 18   Index   Next Page 20

Exception handling
Page 19 of 839
At time of publication only one flag is set at any one time. Future versions maybe set multiple
flags, e.g. E_SYNTAX_ERROR and E_WARNING.
Because of this, it is required to mask out the error type:
if (ErrType & E_SYNTAX_ERROR)
{
// some code
return 0; // continue processing
}
If the error callback function returns a value other than zero, processing stops immediately.
All callback functions must use the correct calling convention. The C definition above contains the
macro PDF_CALL that is defined as __stdcall under Windows. Note that a wrongly defined
calling convention causes an access violation!
When using DynaPDF with C or C++, you can change the calling convention to __fastcall or
__cdecl by changing the macro PDF_CALL in the main interface dynapdf.h and in the project
settings. However, standard call is strongly recommended. Note that the library must be
recompiled when changing the calling convention. Delphi, Visual Basic, and VB .Net require
standard call!
Exception handling in Visual Basic, Visual Basic .Net
The Visual Basic wrapper class CPDF uses events instead of callback functions to pass error
messages and warnings to the user; native language exceptions are not used.
The usage of the event functions is quite easy; just declare a local instance variable of the wrapper
class CPDF in the Option Explicit section of the unit as follows:
Private WithEvents FPDF As CPDF
The command above enables the event support of the class CPDF. The instance variable FPDF is
now listed in the left combo box of the VB code editor.
The right combo box contains the available events, when selecting the event "Error" VB adds
automatically an empty event procedure to your source code:
 

Previous topic: Exception handling, Exception handling in C, C++, C#, Delphi

Next topic: Special issues in Visual Basic and .Net