The Plugin Support functions are all exported from dopus.exe as named functions, and so accessing them is a simple matter of obtaining the function entry point with GetProcAddress and calling the function with the appropriate parameter(s). Defines for the names of all exported functions, along with typedefs for their parameters, are provided in the plugin support.h header file.
Because all Opus plugins are, naturally enough, loaded into the address space of the dopus.exe process, obtaining a module handle to pass to GetProcAddress is as simple as calling GetModuleHandle(0) (or GetModuleHandle("dopus.exe").)
For example, to obtain the address of the GetThumbnailPrefs function, the following code could be used:
PFNGETTHUMBNAILPREFS pfnGetThumbPrefs;
pfnGetThumbPrefs=(PFNGETTHUMBNAILPREFS)GetProcAddress( GetModuleHandle( 0 ),
FUNCNAME_GETTHUMBNAILPREFS );
The plugin support.h header file can also optionally define helper classes which are automatically initialized with the addresses of the exported functions and provide inline wrapper functions which can make using them easier.
To take advantage of the helper classes you must define DOPUS_PLUGIN_HELPER before including the header file. For example,
#define DOPUS_PLUGIN_HELPER #include "plugin support.h"
You will then be able to use the various helper classes in your plugin without having to call GetProcAddress manually. For reasons of efficiency the exported functions have been split into several separate helper classes:
Using the helper classes is as simple as instantiating an instance of the desired class, and then calling the member functions within it. For example, to call the GetThumbnailPrefs function using the helper classes:
DOpusPluginHelperConfig dphc; DOPUSTHUMBNAILPREFSDATA dtp; dtp.cbSize=sizeof(dtp); dphc.GetThumbnailPrefs(&dtp);
Note that most functions that take string parameters are available in both ANSI and Unicode forms, with the exception of the registry functions.