How to load the WPviewPDF.dll dynamically (at runtime)

  • I admit I am fairly new to using DLLs. I have been using the WPviewPDF.dll in my Delphi programs succesfully but only in a static fashion. Can you please provide me with a Delphi example how to load and release the WPviewPDF.dll dynamically.
    Thank you
    Cheers
    Christoph

    • Offizieller Beitrag

    Hi,

    The included unit WPViewPDF1.pas does the dynamic loading for you. You do not have to care about it.

    If you only want to use the methods implemented in the DLL, but not the viewer itself use

    WPViewPDFLoadDLL

    it will initialize these function pointers

    wpview_pdfMerge: fktpdfMerge;
    wpview_pdfPrint: fktpdfPrint;
    wpview_pdfMakeJPEG: fktpdfMakeJPEG;
    wpview_pdfConvertToTIFF: fktpdfConvertToTIFF;

  • Thanks for the reply but I meant something else.
    I want to start my program without loading the DLL on startup. I want to load (and unload) it only when needed.

    Currently every time I start my program I get the message "Cannot load DLL wPDFView02.dll" because I renamed the DLL to wPDFView02x.dll.
    Calling the method ViewerStart does not fix the problem (WPViewPDF1.ViewerStart('wPDFView02x.dll','Christoph Camphausen','xxx',yyy); )

    Thanks for your help.
    Cheers
    Christoph

    • Offizieller Beitrag

    Hi,

    the easiest would be to edit the file WPViewPDF1.PAS:

    VIEWDLLNAME_FULL = 'wPDFView02.dll';

    The DLL is loaded when it is needed the first time, that is only at startup, if you have a TWPViewPDF control on a form somewhere.

    To avoid that crearte the control in code and on demand.

    It is not possible to unload the DLL anymore. This would cause problems with windows, since WPViewPDF is based on a window class.

    Julian