David Kennedy’s Tech Ramblings

Just another WordPress.com weblog

Handy trick for disabling Aero in your applications November 13, 2009

Filed under: Uncategorized — dotnetdave @ 9:24 am

Having only recently moved to the 64bit fold following the purchase of a new PC, I’ve just come across the following useful trick to disable Aero. (Discovered on http://www.codeproject.com/KB/vista/controllingaero.aspx) If you want to ensure compatibility with Vista/Win7 users, or you are having problems as a result of Aero (for example, some DirectX function calls may fail if Aero is active on the desktop running your app) then the following may come in very handy:

    public static class AeroController
        public static readonly uint DWM_EC_DISABLECOMPOSITION = 0;
        public static readonly uint DWM_EC_ENABLECOMPOSITION = 1;
        [DllImport("dwmapi.dll", EntryPoint = "DwmEnableComposition")]
        extern static uint WinDwmEnableComposition(uint uCompositionAction);
        /// <summary>
        /// Enables or Disables Aero on Vista or Win7, required for some compatibility issues
        /// </summary>
        /// <param name="enable">if set to <c>true</c> [enable].</param>
        /// <returns></returns>
        public static bool ControlAero(bool enable)
                if (enable)
                if (!enable)

                return true;
            catch { return false; }

Once added to your project, you can then simply enable/disable Aero with a call such as:


2 Responses to “Handy trick for disabling Aero in your applications”

  1. Dave Says:

    Hmm, disabling Aero doesn’t mean much to me, but I’m interested to know if this blog is run by the same David Kennedy who lived in places like Rocky and Algester; and who studied at QUT in Brisbane for a while…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s