HTMLHELP GetHtmlHelpFunction() { static HTMLHELP s_htmlHelp = NULL; if ( !s_htmlHelp ) { static wxDynamicLibrary s_dllHtmlHelp(wxT("HHCTRL.OCX"), wxDL_VERBATIM); if ( !s_dllHtmlHelp.IsLoaded() ) { wxLogError(_("MS HTML Help functions are unavailable because the MS HTML Help library is not installed on this machine. Please install it.")); } else { s_htmlHelp = (HTMLHELP)s_dllHtmlHelp.GetSymbol(HTMLHELP_NAME); if ( !s_htmlHelp ) { wxLogError(_("Failed to initialize MS HTML Help.")); } } } return s_htmlHelp; }
//============================================================================= // Function: GetVolumes // Purpose: Generate and return a list of all volumes (drives) available. // Notes: //============================================================================= wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset) { ::InterlockedExchange(&s_cancelSearch, FALSE); // reset #if wxUSE_DYNLIB_CLASS if (!s_mprLib.IsLoaded() && s_mprLib.Load(wxT("mpr.dll"))) { #ifdef UNICODE s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(wxT("WNetOpenEnumW")); s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(wxT("WNetEnumResourceW")); #else s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(wxT("WNetOpenEnumA")); s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(wxT("WNetEnumResourceA")); #endif s_pWNetCloseEnum = (WNetCloseEnumPtr)s_mprLib.GetSymbol(wxT("WNetCloseEnum")); } #endif wxArrayString list; //------------------------------- // Local and mapped drives first. //------------------------------- // Allocate the required space for the API call. const DWORD chars = GetLogicalDriveStrings(0, NULL); TCHAR* buf = new TCHAR[chars+1]; // Get the list of drives. GetLogicalDriveStrings(chars, buf); // Parse the list into an array, applying appropriate filters. TCHAR *pVol; pVol = buf; while (*pVol) { FilteredAdd(list, pVol, flagsSet, flagsUnset); pVol = pVol + wxStrlen(pVol) + 1; } // Cleanup. delete[] buf; //--------------------------- // Network Neighborhood next. //--------------------------- // not exclude remote and not removable if (!(flagsUnset & wxFS_VOL_REMOTE) && !(flagsSet & wxFS_VOL_REMOVABLE) ) { // The returned list will be sorted alphabetically. We don't pass // our in since we don't want to change to order of the local drives. wxArrayString nn; if (BuildRemoteList(nn, 0, flagsSet, flagsUnset)) { for (size_t idx = 0; idx < nn.GetCount(); idx++) list.Add(nn[idx]); } } return list; } // GetVolumes