Reputation: 115
Windows 10.
I have 2 monitors. Lets call them the LM (left) and the RM (right). I set for the LM scale 150% and for the RM I set a 100% scale factor.
I found out that if more than 50% of an application's window is on the LM then a pixels of that window are scaled to a 150%, but if more than a 50% of the window is on the RM then it scales to a 100%. So it means that scaling of a Application's window depends on how much of it's part is on the LM or the RM.
So I have the following questions:
Using WINAPI of course.
Upvotes: 0
Views: 1481
Reputation: 104514
Welcome to the world of high-dpi support. Applications that don't declare DPI awareness in their manifest or at startup get automatic scaling based on the scale factor the user has set for his primary monitor.
If you just want to turn off all this automatic scaling stuff, you can start with this call at the start of your program (i.e. first line of WinMain):
#include <windows.h>
#include <shellscalingapi.h>
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
Then link with shcore.lib
.
The above works on Windows 8.1 and up only. So on Windows 7 or Vista, you'd just call SetProcessDPIAware()
at startup instead.
Everything else you asked about at the links below:
https://msdn.microsoft.com/en-us/C9488338-D863-45DF-B5CB-7ED9B869A5E2
Upvotes: 2