Hello,
on my Win 7 64-bit system I have developed a GUI application. My IDE is codeblocks with TDM-GCC 4.9.2.
The next step is, to also support hiDPI monitors.
Because I do not have such a monitor (at the moment) I tried to simulate this with setting the screen-text-scaling of Win7 to e.g. 150%.
My application has also a manifest file that defines it as "dpiAware".
I compile this application with wxWidgets 3.1.0 and also 3.0.3.
Running the compiled "3.1.0-Exe" the return value of GetContentScaleFactor() is 1.50 (because of the system setting).
But the "3.0.3-Exe" always returns GetContentScaleFactor()= 1.00 although the scaling is set to 150%.
Does someone know what I have to do in order to get also GetContentScaleFactor()= 1.50 with my "3.0.3-Exe".
Thanks for your help in advance.
Best regards
Herb
Question to GetContentScaleFactor()
-
- Super wx Problem Solver
- Posts: 469
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Question to GetContentScaleFactor()
I don't think the 3.0.x branch supports dpiawareness. It may not be possible to add it in that branch since the developers like to maintain APi/ABI compatibility. You should be able to get equivalent info using native windows calls like:
(You'll need to link with gdi32 to make that work). I don't currently have a set of 3.0 libraries, so that should work, but I haven't tested it.
Code: Select all
double scaleFactor = GetContentScaleFactor();
#ifdef __WINDOWS__
#if wxCHECK_VERSION(3, 0, 0) && !wxCHECK_VERSION(3, 1, 0)
HDC hdcMeasure = ::CreateCompatibleDC(NULL);
scaleFactor = ::GetDeviceCaps(hdcMeasure, LOGPIXELSX) / 96.0f;
::DeleteDC(hdcMeasure);
#endif
#endif // __WINDOWS__