add wxDL_QUIET flag; use RawGetSymbol() instead of GetSymbol() in wxDL_INIT_FUNC to avoid error messages for missing functions (this is also consistent with wxDL_INIT_FUNC_AW)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -167,6 +167,8 @@ be a combination of the following bits:
|
||||
\twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to
|
||||
the library name (this is done by default).}
|
||||
\twocolitem{wxDL\_DEFAULT}{default flags, same as wxDL\_NOW currently}
|
||||
\twocolitem{wxDL\_QUIET}{don't log an error message if the library couldn't be
|
||||
loaded.}
|
||||
\end{twocollist}
|
||||
|
||||
Returns \true if the library was successfully loaded, \false otherwise.
|
||||
|
@@ -75,6 +75,8 @@ enum wxDLFlags
|
||||
wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded
|
||||
// (only for wxPluginManager)
|
||||
|
||||
wxDL_QUIET = 0x00000020, // don't log an error if failed to load
|
||||
|
||||
wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32
|
||||
};
|
||||
|
||||
@@ -112,8 +114,11 @@ enum wxPluginCategory
|
||||
// with "_t" but it doesn't define a variable but just assigns the loaded value
|
||||
// to it and also allows to pass it the prefix to be used instead of hardcoding
|
||||
// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever)
|
||||
//
|
||||
// notice that this function doesn't generate error messages if the symbol
|
||||
// couldn't be loaded, the caller should generate the appropriate message
|
||||
#define wxDL_INIT_FUNC(pfx, name, dynlib) \
|
||||
pfx ## name = (name ## _t)(dynlib).GetSymbol(#name)
|
||||
pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
|
@@ -101,7 +101,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
|
||||
m_handle = RawLoad(libname, flags);
|
||||
#endif
|
||||
|
||||
if ( m_handle == 0 )
|
||||
if ( m_handle == 0 && !(flags & wxDL_QUIET) )
|
||||
{
|
||||
#ifdef wxHAVE_DYNLIB_ERROR
|
||||
Error();
|
||||
|
@@ -513,9 +513,7 @@ wxDisplayFactoryWin32Base::wxDisplayFactoryWin32Base()
|
||||
{
|
||||
ms_supportsMultimon = 0;
|
||||
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"));
|
||||
|
||||
wxLogNull noLog;
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
|
||||
|
||||
if ( (wxDL_INIT_FUNC(gs_, MonitorFromPoint, dllUser32)) == NULL ||
|
||||
(wxDL_INIT_FUNC(gs_, MonitorFromWindow, dllUser32)) == NULL ||
|
||||
@@ -588,9 +586,7 @@ wxDisplayFactoryMultimon::wxDisplayFactoryMultimon()
|
||||
// implementation
|
||||
EnumDisplayMonitors_t pfnEnumDisplayMonitors;
|
||||
{
|
||||
wxLogNull noLog;
|
||||
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"));
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
|
||||
if ( (wxDL_INIT_FUNC(pfn, EnumDisplayMonitors, dllUser32)) == NULL )
|
||||
return;
|
||||
}
|
||||
@@ -735,7 +731,7 @@ bool wxDisplayImplMultimon::ChangeMode(const wxVideoMode& mode)
|
||||
static ChangeDisplaySettingsEx_t pfnChangeDisplaySettingsEx = NULL;
|
||||
if ( !pfnChangeDisplaySettingsEx )
|
||||
{
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"));
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
|
||||
if ( dllUser32.IsLoaded() )
|
||||
{
|
||||
wxDL_INIT_FUNC_AW(pfn, ChangeDisplaySettingsEx, dllUser32);
|
||||
@@ -805,13 +801,7 @@ wxDisplayFactoryDirectDraw::wxDisplayFactoryDirectDraw()
|
||||
if ( !ms_supportsMultimon )
|
||||
return;
|
||||
|
||||
#if wxUSE_LOG
|
||||
// suppress the errors if ddraw.dll is not found, we're prepared to handle
|
||||
// this
|
||||
wxLogNull noLog;
|
||||
#endif
|
||||
|
||||
m_dllDDraw.Load(_T("ddraw.dll"));
|
||||
m_dllDDraw.Load(_T("ddraw.dll"), wxDL_VERBATIM | wxDL_QUIET);
|
||||
|
||||
if ( !m_dllDDraw.IsLoaded() )
|
||||
return;
|
||||
|
@@ -295,9 +295,7 @@ bool wxTextEntry::AutoCompleteFileNames()
|
||||
static wxDynamicLibrary s_dllShlwapi;
|
||||
if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 )
|
||||
{
|
||||
wxLogNull noLog;
|
||||
|
||||
if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM) )
|
||||
if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
|
||||
{
|
||||
s_pfnSHAutoComplete = NULL;
|
||||
}
|
||||
|
@@ -725,9 +725,7 @@ wxWindowMSW::MSWShowWithEffect(bool show,
|
||||
static bool s_initDone = false;
|
||||
if ( !s_initDone )
|
||||
{
|
||||
wxLogNull noLog;
|
||||
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM);
|
||||
wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
|
||||
wxDL_INIT_FUNC(s_pfn, AnimateWindow, dllUser32);
|
||||
|
||||
s_initDone = true;
|
||||
|
Reference in New Issue
Block a user