Check if aero is enabled

I need to check where windows aero is enabled or not. Can anyone help me with the syntax of DwmIsCompositionEnabled();, or suggest me a better a method of doing it.
How to return a value from this function?
Last edited on
Documentation is here:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969518(v=vs.85).aspx

Here's an example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<dwmapi.h>
#include<iostream>

bool aero_enabled()
{
	BOOL result;
	if (HRESULT err = DwmIsCompositionEnabled(&result) != S_OK) {
		std::cerr << "uh oh\n"; // probably do something better than this.
		return false;
	}
	return result;
}

int main() { 
  std::cout << "has aero: " << aero_enabled() << '\n';
}

You need to link with dwmapi.lib.

... good to finally have a copy of Windows again. (In a VM, at least.)
If you are running Windows 8 or later DWM is always active, you can't turn it off.

Aero ran on Vista or 7, as long as DWM is running. Windows 8 and 10 have removed the functionality to run Aero.
Registered users can post here. Sign in or register to post.