在C#/ VB.NET或C ++ Win32中启用/禁用Aero

如何在C#.NET或C ++ Win32中禁用航空效果?

这是我在C / C ++中的testing代码,但只适用于我的应用程序是runnig

#include <dwmapi.h> int main() { DwmEnableComposition(DWM_EC_DISABLECOMPOSITION); while(true); //... return 0; } //LINK dwmapi.lib 

谢谢

编辑:我想通了

 #include <Windows.h> #include <dwmapi.h> int WINAPI WinMain(HINSTANCE hI, HINSTANCE hP, PSTR str, int c) { DwmEnableComposition(DWM_EC_DISABLECOMPOSITION); MSG msg; ZeroMemory(&msg, sizeof(MSG)); while(GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } //Memory: 314KB //CPU: 0% 

这应该工作:

 [DllImport("dwmapi.dll", PreserveSig = false)] public static extern int DwmEnableComposition(bool fEnable); static void Main(string[] args) { DwmEnableComposition(false); // Your application here. }