Code: (Select All)
Declare Dynamic Library "user32"
Function DPI& Alias SetProcessDpiAwarenessContext (ByVal dpiContext As _Offset)
End Declare
Const UNAWARE = -1, AWARE = -2, PER_MONITOR_AWARE = -3
Const PER_MONITOR_AWARE_V2 = -4, UNAWARE_GDISCALED = -5
_FullScreen
Dim result As Integer
Print _DesktopWidth, _DesktopHeight
Sleep
Print "Setting DPI Awareness Context..."
_FullScreen _Off 'Note if you use _FULLSCREEN, you should turn it OFF before making any change
_Delay .2 'And give it a delay to make certain that it can make that change
result = DPI(AWARE) 'change to setting you like
Print _DesktopWidth, _DesktopHeight
_FullScreen _Stretch
Sleep
System
With the above, a windows user can set DPI Awareness as they wish for their programs. Note that once Awareness is turned off, the system ignores all other calls so you can't just turn it off and on all willy-nilly.
And what *IS* DPI Awareness? It's the automatic scaling of a program according to the settings you have in your window display settings.
For example, if you have your system set to 200% scaling, it's going to automatically scale all your programs 200% in size.
For a 3840 x 2160 display, this means that the biggest program screen you can make and view would be 1920 x 1080 as it'd scale 200% to fill the 3840 x 2160 display completely.
So with this, you can set your program to decide if it wants to do that scaling or not.
If your program is DPI(Aware), it means you're going to do any necessary scaling yourself.
If it's DPI(UnAware), it means you're going to let the system do that automatic scaling.
By monitor is going to depend on your scaling settings on each monitor and where the program is located on the desktop.
Chances are, if you don't know what DPI Awareness is or that Windows automagically resizes and scales things for you, then you won't need to worry about this. This is mainly something that affects people with scale factors built into their system (like many laptops -- mine defaults to 200% scaling) and if you've never noticed it in the past, then it's probably not something you need to concern yourself about anytime soon.
