MCPcopy Create free account
hub / github.com/cztomczak/cefpython / GetSystemDpi

Function GetSystemDpi

src/client_handler/dpi_aware.cpp:129–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void 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
145void GetDpiAwareWindowSize(int* width, int* height) {
146 int dpix = 0;

Callers 2

GetDpiAwareWindowSizeFunction · 0.85
SetBrowserDpiSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected