diff --git a/GreenshotPlugin/UnmanagedHelpers/DWM.cs b/GreenshotPlugin/UnmanagedHelpers/DWM.cs
index 9a355edd1..ef4f2d536 100644
--- a/GreenshotPlugin/UnmanagedHelpers/DWM.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/DWM.cs
@@ -93,6 +93,9 @@ namespace GreenshotPlugin.UnmanagedHelpers {
/// Description of DWM.
///
public class DWM {
+ public static readonly uint DWM_EC_DISABLECOMPOSITION = 0;
+ public static readonly uint DWM_EC_ENABLECOMPOSITION = 1;
+
// DWM
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmRegisterThumbnail(IntPtr dest, IntPtr src, out IntPtr thumb);
@@ -103,19 +106,24 @@ namespace GreenshotPlugin.UnmanagedHelpers {
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmUpdateThumbnailProperties(IntPtr hThumb, ref DWM_THUMBNAIL_PROPERTIES props);
- // Deprecated as of Windows 8 Release Preview
+ // Deprecated as of Windows 8 Release Preview
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmIsCompositionEnabled(out bool enabled);
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out RECT lpRect, int size);
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmEnableBlurBehindWindow(IntPtr hwnd, ref DWM_BLURBEHIND blurBehind);
+ [DllImport("dwmapi", SetLastError = true)]
+ public static extern uint DwmEnableComposition(uint uCompositionAction);
- // Windows 8, e.g.:
- //[DllImport("dwmapi", SetLastError = true)]
- //public static extern DWMAPI DwmShowContact(DWORD dwPointerID, DWM_SHOWCONTACT eShowContact);
+ public static void EnableComposition() {
+ DWM.DwmEnableComposition(DWM.DWM_EC_ENABLECOMPOSITION);
+ }
+ public static void DisableComposition() {
+ DWM.DwmEnableComposition(DWM.DWM_EC_DISABLECOMPOSITION);
+ }
- // Key to ColorizationColor for DWM
+ // Key to ColorizationColor for DWM
private const string COLORIZATION_COLOR_KEY = @"SOFTWARE\Microsoft\Windows\DWM";
///
@@ -123,12 +131,12 @@ namespace GreenshotPlugin.UnmanagedHelpers {
///
/// bool true if DWM is available AND active
public static bool isDWMEnabled() {
- // According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx
- // And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
- // DMW is always enabled on Windows 8! So return true and save a check! ;-)
- if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 2) {
- return true;
- }
+ // According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx
+ // And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
+ // DMW is always enabled on Windows 8! So return true and save a check! ;-)
+ if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 2) {
+ return true;
+ }
if (Environment.OSVersion.Version.Major >= 6) {
bool dwmEnabled;
DWM.DwmIsCompositionEnabled(out dwmEnabled);