1

I set the windows screen resolution to 1920x1080. I have c++ windows API program and need to use GetSystemMetrics function.

int x = GetSystemMetrics(SM_CXSCREEN);//retun x=1536
int y = GetSystemMetrics(SM_CYSCREEN);//retun y=864

As you see I get the different value from 1920x1080. But If I use MFC headers (afx.h) and use MFC dlls in the program settings, then the return value x,y are equal to windows screen resolution (1920x1080).

Why the two methods are not same?

How can I get the correct windows screen resolution in my programs without using MFC?

S_M
  • 85
  • 7

1 Answers1

6

Any chance you are running on Windows with the 125% scaling? Since 1,25 * 1536 = 1920 and 1,25 * 864 = 1080? The I assume MFC is not DPI aware.

Also, see this on how to mark your application as DPI aware.

Community
  • 1
  • 1
Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71