forked from CHMP-HLab/HLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellScalingApi.cs
More file actions
45 lines (34 loc) · 1012 Bytes
/
Copy pathShellScalingApi.cs
File metadata and controls
45 lines (34 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Runtime.InteropServices;
namespace HLab.Sys.Windows.API;
public static partial class ShellScalingApi
{
#region High DPI
public enum ProcessDpiAwareness
{
Unaware = 0,
SystemDpiAware = 1,
PerMonitorDpiAware = 2
}
public enum DpiType : int
{
Effective = 0,
Angular = 1,
Raw = 2,
Default = Effective
} //https://msdn.microsoft.com/en-us/library/windows/desktop/dn280510.aspx
//[LibraryImport("Shcore.dll")]
//public static partial nint GetDpiForMonitor(in nint hmonitor, in DpiType dpiType, out uint dpiX, out uint dpiY);
[DllImport("shcore.dll")]
public static extern uint GetDpiForMonitor(nint hmonitor,
DpiType dpiType,
out uint dpiX,
out uint dpiY);
#endregion
#region The Windows Shell
[LibraryImport("Shcore.dll")]
public static partial int GetScaleFactorForMonitor(
nint hMonitor,
ref int scale
);
#endregion
}