Click here to Skip to main content
13,593,447 members
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 29 Aug 2009
Licenced CPOL

Enabling and Disabling Aero interface on Windows Vista and 7

, 29 Aug 2009
Rate this:
Please Sign up or sign in to vote.
Is Aero causing your application to become unstable? Jump in...


Is your application incompatible with Aero interface? Do you want to disable Aero from your application? You are in the right place.

Using the Code

Using this code is really simple, almost anyone can use it easily.

Just add System.Runtime.InteropServices to your usings and paste this code into the application.

public readonly uint DWM_EC_DISABLECOMPOSITION = 0;
public readonly uint DWM_EC_ENABLECOMPOSITION = 1;
[DllImport("dwmapi.dll", EntryPoint = "DwmEnableComposition")]
protected extern static uint Win32DwmEnableComposition(uint uCompositionAction);
public bool ControlAero(bool enable)
    if (enable)
    if (!enable)

    return true;  
  catch { return false; }

You can disable Aero with ControlAero(false), and enable Aero with ControlAero(true). If you are on an XP or prior Windows operating system, this method will return false, if everything is done without an exception, it will return true. After your application is closed, Aero will get enabled automatically.


  • 29th August, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Turkey Turkey
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
programmerdon7-Oct-11 7:46
memberprogrammerdon7-Oct-11 7:46 
GeneralMy vote of 1 Pin
Dave Kreskowiak17-Sep-09 7:16
mvpDave Kreskowiak17-Sep-09 7:16 
GeneralMy vote of 2 Pin
Wizzard031-Aug-09 13:39
memberWizzard031-Aug-09 13:39 
GeneralNeed more Pin
Sentax29-Aug-09 8:52
memberSentax29-Aug-09 8:52 
GeneralRe: Need more Pin
chinese_zmm31-Aug-09 15:20
memberchinese_zmm31-Aug-09 15:20 
GeneralGood to know, but... Pin
Peter Souza29-Aug-09 8:39
memberPeter Souza29-Aug-09 8:39 
GeneralMy vote of 1 Pin
xliqz29-Aug-09 8:30
memberxliqz29-Aug-09 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180618.1 | Last Updated 29 Aug 2009
Article Copyright 2009 by SimpleData
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid