+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
-using System.Runtime.InteropServices;\r
-using System.Drawing;\r
-using SharpDX;\r
-\r
-namespace FDK\r
-{\r
- //http://spazzarama.wordpress.com/2009/09/30/enable-or-disable-dwm-composition-aero/\r
- /// <summary>\r
- /// To control Aerograph in Vista and Windows7. Don't use this class in XP.\r
- /// </summary>\r
- public static class DWM\r
- {\r
- const uint DWM_EC_DISABLECOMPOSITION = 0;\r
- const uint DWM_EC_ENABLECOMPOSITION = 1;\r
-\r
- [DllImport( "dwmapi.dll", EntryPoint = "DwmEnableComposition" )]\r
- extern static uint DwmEnableComposition( uint compositionAction );\r
- [DllImport( "dwmapi.dll", EntryPoint = "DwmEnableComposition" )]\r
- public extern static bool DwmIsCompositionEnabled(out bool pfEnabled);\r
- [DllImport( "dwmapi.dll", EntryPoint = "DwmFlush" )]\r
- extern static int DwmFlush();\r
-// [DllImport( "dwmapi.dll", EntryPoint = "DwmEnableMMCSS" )]\r
-// extern static int DwmEnableMMCSS( bool fEnableMMCSS );\r
- [DllImport( "dwmapi.dll", EntryPoint = "DwmFlush" )]\r
- extern static int DwmEnableMMCSS( bool fEnableMMCSS );\r
-\r
- public static int IsCompositionEnabled(out bool enabled)\r
- {\r
-#if TEST_Direct3DEx\r
- return DwmIsCompositionEnabled( out enabled );\r
-#else\r
- enabled = false;\r
- return 0;\r
-#endif\r
- }\r
- public static int Flush()\r
- {\r
-#if TEST_Direct3DEx\r
- return DwmFlush();\r
-#else\r
- return 0; // 0(S_OK)なら成功\r
-#endif\r
- }\r
-\r
- /// <summary> \r
- /// Enable/Disable DWM composition (aka Aero) \r
- /// </summary> \r
- /// <param name="bIsAeroEnabled">True to enable composition, false to disable composition.</param> \r
- /// <returns>True if the operation was successful.</returns> \r
- public static bool EnableComposition( bool bIsAeroEnabled )\r
- {\r
-// DwmEnableMMCSS( true );\r
-#if TEST_Direct3D9Ex\r
- try\r
- {\r
- if ( bIsAeroEnabled )\r
- {\r
- DwmEnableComposition( DWM_EC_ENABLECOMPOSITION );\r
- }\r
- else\r
- {\r
- DwmEnableComposition( DWM_EC_DISABLECOMPOSITION );\r
- }\r
- return true;\r
- }\r
- catch ( DllNotFoundException )\r
- {\r
- return false;\r
- }\r
-#else\r
- return true;\r
-#endif\r
- } \r
- }\r
-}\r