Page 2 of 2

Re: [Module] DPI Awareness

Posted: Fri Jun 07, 2019 10:55 am
by Rinzwind
Just a note... it works as long as you do not move the Window to a monitor with different DPI settings.

Re: [Module] DPI Awareness

Posted: Mon Oct 28, 2019 11:52 am
by dige
Hello Thunder93, many thanks for the Per-Monitor DPI Awareness example.

Since the PB dpi aware supported is there a way acivate 'Per-Monitor DPI Awareness'
and use the PB commands?

Ciao Dige

Re: [Module] DPI Awareness

Posted: Fri Aug 28, 2020 4:30 am
by Rinzwind
Just a note

As far as I could figure out by searching the internet, the DPI awareness constant values as needed for SetProcessDpiAwarenessContext are as follows:

Code: Select all

#DPI_AWARENESS_CONTEXT_UNAWARE = 16
#DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34

corrected by peeking with visual studio c++... and checking result in taskmgr after SetProcessDpiAwarenessContext_  (nowhere else to be found...) :
#DPI_AWARENESS_CONTEXT_UNAWARE = $6010 ;24592
#DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = $9011 ;36881
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = $12 ;18
#DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = $22 ;34
#DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED = $40006010 ;1073766416
They're some wacky pointer anonymous structure stuff? MS...

Code: Select all

#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
#define DPI_AWARENESS_CONTEXT_UNAWARE               ((DPI_AWARENESS_CONTEXT)-1)
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE          ((DPI_AWARENESS_CONTEXT)-2)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE     ((DPI_AWARENESS_CONTEXT)-3)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2  ((DPI_AWARENESS_CONTEXT)-4)
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED     ((DPI_AWARENESS_CONTEXT)-5)