【问题标题】:Enable / Disable Aero in C#/VB.NET or C++ Win32在 C#/VB.NET 或 C++ Win32 中启用/禁用 Aero
【发布时间】:2010-10-18 18:21:31
【问题描述】:

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

这是我在 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%

【问题讨论】:

  • 您想为用户永久禁用它们吗?

标签: c# .net c++ windows winapi


【解决方案1】:

这应该可行:

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern int DwmEnableComposition(bool fEnable);

static void Main(string[] args)
{
    DwmEnableComposition(false);

    // Your application here.
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-21
    • 2014-07-10
    • 1970-01-01
    相关资源
    最近更新 更多