启用/禁用航空在C#/ VB.NET或C ++的Win32 [英] Enable / Disable Aero in C#/VB.NET or C++ Win32
本文介绍了启用/禁用航空在C#/ VB.NET或C ++的Win32的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何禁用C#.NET或C ++的Win32 ??? Aero特效
这是我的测试code在C / C ++,但只有当我的应用程序运行过程中出现
的#include< dwmapi.h>
诠释的main()
{
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
而(真);
// ...
返回0;
}
// LINK dwmapi.lib
感谢
编辑:我理解了它
的#include< WINDOWS.H>
#包括< dwmapi.h>
INT WINAPI的WinMain(HINSTANCEHINSTANCE惠普,PSTR STR,INT C)
{
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
味精味精;
ZeroMemory(安培;味精,的sizeof(MSG));
而(的GetMessage(安培;味精,0,0,0))
{
的TranslateMessage(安培;味精);
在DispatchMessage(&安培;味精);
}
返回0;
}
//内存:314KB
// CPU:0%
解决方案
这应该工作:
[的DllImport(dwmapi.dll,preserveSig = FALSE)]
公共静态外部INT DwmEnableComposition(布尔fEnable);
静态无效的主要(字串[] args)
{
DwmEnableComposition(假);
//此处是您的应用程序。
}
How to disable aero effects in C# .NET or C++ Win32 ???
This is my test code in C/C++, but only works if my app is runnig
#include <dwmapi.h>
int main()
{
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
while(true);
//...
return 0;
}
//LINK dwmapi.lib
Thanks
Edit: i figured it out
#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%
解决方案
This should work:
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern int DwmEnableComposition(bool fEnable);
static void Main(string[] args)
{
DwmEnableComposition(false);
// Your application here.
}
这篇关于启用/禁用航空在C#/ VB.NET或C ++的Win32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文