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

Function GetProcessDpiAwareness

src/client_handler/dpi_aware.cpp:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40PROCESS_DPI_AWARENESS GetProcessDpiAwareness() {
41 // Win8.1 supports monitor-specific DPI scaling, so it is
42 // recommended to use GetProcessDPIAwareness instead of the
43 // deprecated IsProcessDPIAware.
44 typedef HRESULT(WINAPI *GetProcessDpiAwarenessPtr)
45 (HANDLE,PROCESS_DPI_AWARENESS*);
46 GetProcessDpiAwarenessPtr get_process_dpi_awareness_func =
47 reinterpret_cast<GetProcessDpiAwarenessPtr>(
48 GetProcAddress(GetModuleHandleA("user32.dll"),
49 "GetProcessDpiAwarenessInternal"));
50 if (get_process_dpi_awareness_func) {
51 HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false,
52 GetCurrentProcessId());
53 PROCESS_DPI_AWARENESS result;
54 HRESULT hr = get_process_dpi_awareness_func(hProcess, &result);
55 if (SUCCEEDED(hr)) {
56 return result;
57 }
58 // Possible failures include E_INVALIDARG or E_ACCESSDENIED.
59 LOG(INFO) << "[Browser process] GetProcessDpiAwareness():"
60 " hr=" << hr;
61 }
62 return PROCESS_DPI_UNAWARE;
63}
64
65void SetProcessDpiAware() {
66 // Win8.1 supports monitor-specific DPI scaling, so it is

Callers 1

IsProcessDpiAwareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected