+// utility functions to manage the loading/unloading
+// of hhctrl.ocx
+#ifndef UNICODE
+typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCSTR, UINT, DWORD );
+#define HTMLHELP_NAME "HtmlHelpA"
+#else
+typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCWSTR, UINT, DWORD );
+#define HTMLHELP_NAME "HtmlHelpW"
+#endif
+// dll symbol handle
+static HTMLHELP gs_htmlHelp = 0;
+
+static bool LoadHtmlHelpLibrary()
+{
+ wxPluginLibrary *lib = wxPluginManager::LoadLibrary( _T("HHCTRL.OCX"), wxDL_DEFAULT | wxDL_VERBATIM );
+
+ if( !lib->IsLoaded() )
+ {
+ wxLogError(_("MS HTML Help functions are unavailable because the MS HTML Help library is not installed on this machine. Please install it."));
+ return FALSE;
+ }
+ else
+ {
+ gs_htmlHelp = (HTMLHELP)lib->GetSymbol( HTMLHELP_NAME );
+
+ if( !gs_htmlHelp )
+ {
+ wxLogError(_("Failed to initialize MS HTML Help."));
+
+ lib->UnrefLib();
+ return FALSE ;
+ }
+ }
+
+ return TRUE;
+}
+
+static void UnloadHtmlHelpLibrary()
+{
+ if( gs_htmlHelp )
+ {
+ wxPluginManager::UnloadLibrary( _T("HHCTRL.OCX") );
+ gs_htmlHelp = 0;
+ }
+}
+