| 127 | } |
| 128 | |
| 129 | void GetSystemDpi(int* dpix, int* dpiy) { |
| 130 | // Win7 DPI (Control Panel > Appearance and Personalization > Display): |
| 131 | // text size Larger 150% => dpix/dpiy 144 |
| 132 | // text size Medium 125% => dpix/dpiy 120 |
| 133 | // text size Smaller 100% => dpix/dpiy 96 |
| 134 | // |
| 135 | // DPI settings should not be cached. When SetProcessDpiAware |
| 136 | // is not yet called, then OS returns 96 DPI, even though it |
| 137 | // is set to 144 DPI. After DPI Awareness is enabled for the |
| 138 | // running process it will return the correct 144 DPI. |
| 139 | HDC hdc = GetDC(HWND_DESKTOP); |
| 140 | *dpix = GetDeviceCaps(hdc, LOGPIXELSX); |
| 141 | *dpiy = GetDeviceCaps(hdc, LOGPIXELSY); |
| 142 | ReleaseDC(HWND_DESKTOP, hdc); |
| 143 | } |
| 144 | |
| 145 | void GetDpiAwareWindowSize(int* width, int* height) { |
| 146 | int dpix = 0; |
no outgoing calls
no test coverage detected