-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDWM.cs
168 lines (139 loc) · 5.57 KB
/
DWM.cs
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using System;
using System.Runtime.InteropServices;
using FMUtils.WinApi;
namespace FMUtils
{
public static class DWM
{
[DllImport("dwmapi.dll")]
public static extern void DwmIsCompositionEnabled(ref bool pfEnabled);
[DllImport("dwmapi.dll")]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
[DllImport("dwmapi.dll")]
public static extern int DwmRegisterThumbnail(IntPtr dest, IntPtr src, out IntPtr thumb);
[DllImport("dwmapi.dll")]
public static extern int DwmUnregisterThumbnail(IntPtr thumb);
[DllImport("dwmapi.dll")]
public static extern int DwmQueryThumbnailSourceSize(IntPtr thumb, out PSIZE size);
[DllImport("dwmapi.dll")]
public static extern int DwmUpdateThumbnailProperties(IntPtr hThumb, ref DWM_THUMBNAIL_PROPERTIES props);
[DllImport("dwmapi.dll", EntryPoint = "#127", PreserveSig = false)]
public static extern void DwmGetColorizationParameters(out DWM_COLORIZATION_PARAMS parameters);
[DllImport("dwmapi.dll", EntryPoint = "#131", PreserveSig = false)]
public static extern void DwmSetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters, uint u);
[DllImport("dwmapi.dll")]
public static extern void DwmGetColorizationColor(out uint ColorizationColor, out bool ColorizationOpaqueBlend);
[DllImport("dwmapi.dll")]
public static extern int DwmGetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE dwAttribute, out Windowing.RECT pvAttribute, uint cbAttribute);
public struct DWM_COLORIZATION_PARAMS
{
public UInt32 Color;
public UInt32 Afterglow;
public UInt32 ColorBalance;
public UInt32 AfterglowBalance;
public UInt32 BlurBalance;
public UInt32 GlassReflectionIntensity;
public UInt32 OpaqueBlend;
public DWM_COLORIZATION_PARAMS(UInt32 color, UInt32 afterglow, UInt32 colorbalance, UInt32 afterglowbalance, UInt32 blurbalance, UInt32 glassreflectionintensity, UInt32 opaqueblend)
{
Color = color;
Afterglow = afterglow;
ColorBalance = colorbalance;
AfterglowBalance = afterglow;
BlurBalance = blurbalance;
GlassReflectionIntensity = glassreflectionintensity;
OpaqueBlend = opaqueblend;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct Margins
{
public int Left;
public int Right;
public int Top;
public int Bottom;
}
[StructLayout(LayoutKind.Sequential)]
public struct PSIZE
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential)]
public struct DWM_THUMBNAIL_PROPERTIES
{
public int dwFlags;
public Windowing.RECT rcDestination;
public Windowing.RECT rcSource;
public byte opacity;
public bool fVisible;
public bool fSourceClientAreaOnly;
}
/*
[StructLayout(LayoutKind.Sequential)]
public struct Rect
{
public Rect(int left, int top, int right, int bottom)
{
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
public int Left;
public int Top;
public int Right;
public int Bottom;
public Rectangle toRectangle()
{
return new Rectangle(Left, Top, Right - Left, Bottom - Top);
}
}
*/
public static int DWM_TNP_VISIBLE = 0x8;
public static int DWM_TNP_OPACITY = 0x4;
public static int DWM_TNP_RECTDESTINATION = 0x1;
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969530(v=vs.85).aspx
public enum DWMWINDOWATTRIBUTE
{
/// <summary>
/// [get] Is non-client rendering enabled/disabled
/// </summary>
DWMWA_NCRENDERING_ENABLED = 1,
/// <summary>
/// [set] Non-client rendering policy
/// </summary>
DWMWA_NCRENDERING_POLICY,
/// <summary>
/// [set] Potentially enable/forcibly disable transitions
/// </summary>
DWMWA_TRANSITIONS_FORCEDISABLED,
/// <summary>
/// [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame.
/// </summary>
DWMWA_ALLOW_NCPAINT,
/// <summary>
/// [get] Bounds of the caption button area in window-relative space.
/// </summary>
DWMWA_CAPTION_BUTTON_BOUNDS,
/// <summary>
/// [set] Is non-client content RTL mirrored
/// </summary>
DWMWA_NONCLIENT_RTL_LAYOUT,
/// <summary>
/// [set] Force this window to display iconic thumbnails.
/// </summary>
DWMWA_FORCE_ICONIC_REPRESENTATION,
/// <summary>
/// [set] Designates how Flip3D will treat the window.
/// </summary>
DWMWA_FLIP3D_POLICY,
/// <summary>
/// [get] Gets the extended frame bounds rectangle in screen space.
/// Additional arguements are RECT and sizeof(RECT)
/// </summary>
DWMWA_EXTENDED_FRAME_BOUNDS,
DWMWA_LAST
};
}
}