FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved. // License: New BSD License. // Website: http://code.google.com/p/cefpython/ // Windows only #pragma comment(lib, "Gdi32.lib") #include #include "dpi_aware.h" #include "include/wrapper/cef_closure_task.h" #include "include/base/cef_bind.h" #include "LOG_DEBUG.h" const int DEFAULT_DPIX = 96; bool IsProcessDpiAware() { typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID); IsProcessDPIAwarePtr is_process_dpi_aware_func = reinterpret_cast( GetProcAddress(GetModuleHandleA("user32.dll"), "IsProcessDPIAware")); BOOL is_aware = FALSE; if (is_process_dpi_aware_func) { is_aware = is_process_dpi_aware_func(); if (is_aware == TRUE) { return true; } } // GetProcessDpiAwareness is available only on Win8. So it // should be called only as a back-up plan after IsProcessDPIAware // was called. Also if IsProcessDPIAware returned false, // then GetProcessDpiAwareness is called as well. if (GetProcessDpiAwareness() != PROCESS_DPI_UNAWARE) { return true; } return false; } PROCESS_DPI_AWARENESS GetProcessDpiAwareness() { // Win8.1 supports monitor-specific DPI scaling, so it is // recommended to use GetProcessDPIAwareness instead of the // deprecated IsProcessDPIAware. typedef HRESULT(WINAPI *GetProcessDpiAwarenessPtr) (HANDLE,PROCESS_DPI_AWARENESS*); GetProcessDpiAwarenessPtr get_process_dpi_awareness_func = reinterpret_cast( GetProcAddress(GetModuleHandleA("user32.dll"), "GetProcessDpiAwarenessInternal")); if (get_process_dpi_awareness_func) { HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessId()); PROCESS_DPI_AWARENESS result; HRESULT hr = get_process_dpi_awareness_func(hProcess, &result); if (SUCCEEDED(hr)) { return result; } // Possible failures include E_INVALIDARG or E_ACCESSDENIED. LOG_DEBUG

Back | FazBrowse Home | New Git URL