I am writing a windows program which let user switch the resolution between 1920*1080 and 3840*2160, that means between FHD and 4K.
I tried to use "GetSystemMetrics" to get current resolution.
//Algorithm #1
//Get current resolution and resolution scaling.
xScreenResolution = GetSystemMetrics(SM_CXSCREEN);
yScreenResolution = GetSystemMetrics(SM_CYSCREEN);
cout << "Current Resolution is: " << xScreenResolution << "x" << yScreenResolution << endl;
For example, if I am using a resolution of 3840*2160, I expected the program will give me the resolution of 3840*2160. However, the program just outputs 1536x864, which is the resolution after Windows had performed rescaling.
So I want to know how to get the scaling factor (100%, 200%, 250%, etc.) programmatically like display settings in Windows 10. display settings in Windows 10