| 25 | static HMODULE hComctl32 = NULL; |
| 26 | |
| 27 | void BecomeDPIAware(void) { |
| 28 | // Make the process DPI-aware... hopefully |
| 29 | // Windows 10 1703+ per-monitor v2 |
| 30 | _SetProcessDpiAwarenessContext $SetProcessDpiAwarenessContext = (_SetProcessDpiAwarenessContext)GetProcAddress(LoadLibrary(L"user32.dll"), "SetProcessDpiAwarenessContext"); |
| 31 | if ($SetProcessDpiAwarenessContext) { |
| 32 | $SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | // Windows 8.1 - 10 1607 per-monitor v1 |
| 37 | _SetProcessDpiAwareness $SetProcessDpiAwareness = (_SetProcessDpiAwareness)GetProcAddress(LoadLibrary(L"shcore.dll"), "SetProcessDpiAwareness"); |
| 38 | if ($SetProcessDpiAwareness) { |
| 39 | $SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | // Windows Vista - 8 |
| 44 | _SetProcessDPIAware $SetProcessDPIAware = (_SetProcessDPIAware)GetProcAddress(LoadLibrary(L"user32.dll"), "SetProcessDPIAware"); |
| 45 | if ($SetProcessDPIAware) { |
| 46 | $SetProcessDPIAware(); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Handling for SxS contexts (mainly for comctl 6.0) |
| 51 | void IsolationAwareStart(ULONG_PTR *cookie) { |