From 2f86dfdf1e79a462bb9e8524457f2a409837533b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Nov 2008 17:46:46 +0000 Subject: [PATCH] display enumeration functions are in coredll.dll and not user32.dll under CE (closes #10189) [backport of r52077] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/display.cpp | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 283c9c13eb..311ae5202d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -119,6 +119,7 @@ wxMSW: - Fixed wxArtProvider::GetSizeHint() to return 16x16 for wxART_FRAME_ICON. - Fixed toolbar buttons so that they don't disappear temporarily when clicked if the event handler causes window update. +- Fix display enumeration under WinCE (Vince Harron). wxGTK: diff --git a/src/msw/display.cpp b/src/msw/display.cpp index afd5d732ba..e415dc1640 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -86,6 +86,13 @@ { 0xB3A6F3E0, 0x2B43, 0x11CF, { 0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 } }; #endif // wxUSE_DIRECTDRAW +// display functions are found in different DLLs under WinCE and normal Win32 +#ifdef __WXWINCE__ +static const wxChar displayDllName[] = _T("coredll.dll"); +#else +static const wxChar displayDllName[] = _T("user32.dll"); +#endif + // ---------------------------------------------------------------------------- // typedefs for dynamically loaded Windows functions // ---------------------------------------------------------------------------- @@ -511,28 +518,28 @@ wxDisplayFactoryWin32Base::wxDisplayFactoryWin32Base() { ms_supportsMultimon = 0; - wxDynamicLibrary dllUser32(_T("user32.dll")); - wxLogNull noLog; + wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM); + gs_MonitorFromPoint = (MonitorFromPoint_t) - dllUser32.GetSymbol(wxT("MonitorFromPoint")); + dllDisplay.GetSymbol(wxT("MonitorFromPoint")); if ( !gs_MonitorFromPoint ) return; gs_MonitorFromWindow = (MonitorFromWindow_t) - dllUser32.GetSymbol(wxT("MonitorFromWindow")); + dllDisplay.GetSymbol(wxT("MonitorFromWindow")); if ( !gs_MonitorFromWindow ) return; gs_GetMonitorInfo = (GetMonitorInfo_t) - dllUser32.GetSymbolAorW(wxT("GetMonitorInfo")); + dllDisplay.GetSymbolAorW(wxT("GetMonitorInfo")); if ( !gs_GetMonitorInfo ) return; ms_supportsMultimon = 1; - // we can safely let dllUser32 go out of scope, the DLL itself will + // we can safely let dllDisplay go out of scope, the DLL itself will // still remain loaded as all Win32 programs use it } } @@ -598,9 +605,9 @@ wxDisplayFactoryMultimon::wxDisplayFactoryMultimon() { wxLogNull noLog; - wxDynamicLibrary dllUser32(_T("user32.dll")); + wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM); pfnEnumDisplayMonitors = (EnumDisplayMonitors_t) - dllUser32.GetSymbol(wxT("EnumDisplayMonitors")); + dllDisplay.GetSymbol(wxT("EnumDisplayMonitors")); if ( !pfnEnumDisplayMonitors ) return; } @@ -743,11 +750,11 @@ bool wxDisplayImplMultimon::ChangeMode(const wxVideoMode& mode) static ChangeDisplaySettingsEx_t pfnChangeDisplaySettingsEx = NULL; if ( !pfnChangeDisplaySettingsEx ) { - wxDynamicLibrary dllUser32(_T("user32.dll")); - if ( dllUser32.IsLoaded() ) + wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM); + if ( dllDisplay.IsLoaded() ) { pfnChangeDisplaySettingsEx = (ChangeDisplaySettingsEx_t) - dllUser32.GetSymbolAorW(_T("ChangeDisplaySettingsEx")); + dllDisplay.GetSymbolAorW(_T("ChangeDisplaySettingsEx")); } //else: huh, no user32.dll??