+ wxPluginLibrary *lib = wxPluginManager::LoadLibrary( _T("HHCTRL.OCX"), wxDL_DEFAULT | wxDL_VERBATIM );
+
+ if( !lib )
+ {
+ 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 )
+ {
+ if (wxPluginManager::UnloadLibrary( _T("HHCTRL.OCX") ))
+ gs_htmlHelp = 0;
+ }
+}
+
+static HWND GetSuitableHWND(wxCHMHelpController* controller)
+{
+ if (controller->GetParentWindow())
+ return (HWND) controller->GetParentWindow()->GetHWND();
+ else if (wxTheApp->GetTopWindow())