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

标签 c# .net c++ windows winapi

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

这是我在 C/C++ 中的测试代码,但只有在我的应用程序运行时才有效

#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.
}

关于c# - 在 C#/VB.NET 或 C++ Win32 中启用/禁用 Aero,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3962140/

相关文章:

c# - 如何检查字体是否支持特定样式

c++ - Visual C++ 监控访问网站的最佳方式?

python - 如何记住 PyQt 应用程序的最后一个几何图形?

c# - 在使用 SqlBulkCopy 的类上实现 Dispose

c# - 如何在没有独占锁的情况下使用 FileStream 附加到文件?

c# - ExtractIconEx nIconIndex 参数的正确用法?

c# - 如何在不关闭 C# 中的 NetworkStream 的情况下发出数据结束信号

c++ - 如何在 Visual Studio 2005 (C++) 中声明复杂变量

c++ - 为什么 OpenSSL 会给我一个 "called a function you should not call"错误?

c# - 神经网络问题