-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathNative.cs
More file actions
81 lines (65 loc) · 2.01 KB
/
Native.cs
File metadata and controls
81 lines (65 loc) · 2.01 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Runtime.InteropServices;
namespace TensorStack.WPF
{
public static class Native
{
public const int WM_GETMINMAXINFO = 0x0024;
public const uint MONITOR_DEFAULTTONEAREST = 0x00000002;
[DllImport("USER32.DLL")]
public static extern bool GetCursorPos(out POINT lpPoint);
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("USER32.DLL")]
public static extern IntPtr MonitorFromWindow(IntPtr handle, uint flags);
[DllImport("USER32.DLL")]
public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
[DllImport("USER32.DLL")]
public static extern int GetDpiForWindow(IntPtr hwnd);
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
public RECT(int left, int top, int right, int bottom)
{
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct MONITORINFO
{
public int cbSize;
public RECT rcMonitor;
public RECT rcWork;
public uint dwFlags;
}
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
X = x;
Y = y;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct MINMAXINFO
{
public POINT ptReserved;
public POINT ptMaxSize;
public POINT ptMaxPosition;
public POINT ptMinTrackSize;
public POINT ptMaxTrackSize;
}
}
}