WinWorkstation.st
changeset 8904 4247707f2d27
parent 8903 24bbd43fb28b
child 8905 d4525130d743
--- a/WinWorkstation.st	Tue Nov 26 16:43:54 2019 +0100
+++ b/WinWorkstation.st	Wed Nov 27 14:03:14 2019 +0100
@@ -6731,6 +6731,49 @@
 
 !WinWorkstation class methodsFor:'queries - monitor'!
 
+isHighDpiAware
+    "answers if this app is high dpi aware"
+
+    "
+        Screen isHighDpiAware.     
+    "       
+
+    |isHighDpiAware|
+
+    isHighDpiAware := false.
+
+%{
+        HINSTANCE hShcore = LoadLibrary("Shcore.dll");
+
+        if (hShcore) {
+            static HRESULT (__stdcall *P_GetProcessDpiAwareness)(HANDLE, VOID*);
+            P_GetProcessDpiAwareness = (HRESULT (__stdcall *)(HANDLE, VOID*))GetProcAddress(hShcore, "GetProcessDpiAwareness");
+
+            if (P_GetProcessDpiAwareness) {
+                UINT processDpiAwarness = 0;
+
+                if ((*P_GetProcessDpiAwareness)(NULL, &processDpiAwarness) == S_OK) {
+                    if (processDpiAwarness == 0) {
+                        isHighDpiAware = false;   
+                    } else {
+                        isHighDpiAware = true;      
+                    }
+                } else {
+                    printf("Call \"GetProcessDpiAwareness()\" failed\n");
+                };      
+            } else {
+                printf("Loading \"GetProcessDpiAwareness()\" failed\n");
+            }
+        } else {
+            printf("Loading \"Shcore.dll\" failed\n");
+        }
+%}.
+
+    ^ isHighDpiAware
+
+    "Created: / 27-11-2019 / 13:40:04 / Stefan Reise"
+!
+
 monitorDeviceNameForPoint:aPoint
     "given a point, return its monitor device name or nil if failed"