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

问题描述 投票:0回答:2

如何在 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
2个回答
4
投票

这应该有效:

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

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

    // Your application here.
}

0
投票
声明子 DwmEnableComposition Lib“dwmapi.dll”Alies“DwmEnableComposition(uComposition 作为操作 UInt32)

设计师表格.vb

公共课DesignerForm
   Private Sub DesignerForm_Load(sender As Object, e As EventArgs) 处理 MyBase.Load
       DwmEnableComposition(Convert.ToInt32(0)
   结束子
下课
© www.soinside.com 2019 - 2024. All rights reserved.