Reputation: 37228
I'm having an issue in that I am coding for a non-dpi aware process, until a bug fix lands.
So for now I need to do a work around. My thought is this: figure out the scale up factor, and give my elements width/height scaled down by that much.
So right now I am drawing a canvas that is full width and height of second monitor, it s 1920 x 1080
(WxH). But visuaully (as measured by photoshop after screenshot) it is coming out to be 2880 x 1620
. This is a scale up factor of 1.5 (2880 divided by 1920 or 1620 divided by 1080).
I tried getting dpi with methods of GetDeviceCaps
and EnumDisplaysettings
but all of them returned that of the primary monitor (note: EnumDisplaySettings
sets dmLogPixels
which I think is DPI to 0 if I do EnumDisplaySettings
with constnat of ENUM_REGISTRY_SETTINGS
so I had to use ENUM_CURRENT_SETTINGS
).
The only method i found that returns differently is GetDpiForMonitor
with MONITOR_DPI_TYPE
constnat of MDT_Angular_DPI
or MDT_Raw_DPI
, if I use MDT_Effective_DPI
it gives that of the primary monitor.
So now this is my results of running GetDpiForMonitor
:
None of the secondary values divided by the primary are giving me a scale up factor 1.5. Is there anyway to get this scale factor?
Thanks
Upvotes: 0
Views: 509
Reputation: 37228
I just had an idea nad it works I am getting the scaled height/width with any of the three methods outlined in my question here: Improper width and height for second monitor from GetMonitorInfo and GetDeviceCaps
GetDeviceCaps
on hdcScreen
orGetMonitorInfo
orEnumDisplayMonitors
Then I divide it by the width/height from EnumDisplaySettings
.
This is the only way I found how, is there any other way? Can the experts please verify.
Upvotes: 1