锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
1. Difference between resolution and DPI:
Resolution: 鏄劇ず鍣╳idth*height鏈夊澶?br>DPI: 姣?Inch 鏄劇ず澶氬皯涓偣(dot)
2. How to get resolution:
unsigned int w = ::GetSystemMetrics(SM_CXSCREEN);
unsigned int h = ::GetSystemMetrics(SM_CYSCREEN);
RECT rect;
::GetWindowRect(::GetDesktopWindow(), &rect);
unsigned int w = ::abs(rect.right - rect.left);
unsigned int h = ::abs(rect.bottom - rect.top);
HDC hDC = ::GetDC(0);
int dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
int dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
// dpiX == dpiY