| 15 | const int DEFAULT_DPIX = 96; |
| 16 | |
| 17 | bool IsProcessDpiAware() { |
| 18 | typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID); |
| 19 | IsProcessDPIAwarePtr is_process_dpi_aware_func = |
| 20 | reinterpret_cast<IsProcessDPIAwarePtr>( |
| 21 | GetProcAddress(GetModuleHandleA("user32.dll"), |
| 22 | "IsProcessDPIAware")); |
| 23 | BOOL is_aware = FALSE; |
| 24 | if (is_process_dpi_aware_func) { |
| 25 | is_aware = is_process_dpi_aware_func(); |
| 26 | if (is_aware == TRUE) { |
| 27 | return true; |
| 28 | } |
| 29 | } |
| 30 | // GetProcessDpiAwareness is available only on Win8. So it |
| 31 | // should be called only as a back-up plan after IsProcessDPIAware |
| 32 | // was called. Also if IsProcessDPIAware returned false, |
| 33 | // then GetProcessDpiAwareness is called as well. |
| 34 | if (GetProcessDpiAwareness() != PROCESS_DPI_UNAWARE) { |
| 35 | return true; |
| 36 | } |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | PROCESS_DPI_AWARENESS GetProcessDpiAwareness() { |
| 41 | // Win8.1 supports monitor-specific DPI scaling, so it is |
no test coverage detected