求关闭显卡硬件加速的API 或者实现代码

erqieshi 2012-07-04 11:02:01
右键单击桌面→属性→设置→高级→疑难解答
可以设置硬件加速

但是我需要在程序里动态关闭硬件加速
安装时修改注册表也可(但是我发现硬件加速的注册表项在不同电脑上的几乎全部不同)

求一个可以对之操作的API
要是没有API给个能实现的代码即可(操作注册表也可)

最好是C/C++代码
...全文
722 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiongshuaihao 2014-08-12
  • 打赏
  • 举报
回复
LZ是怎么解决的 必须还得先 修改注册表? 那这段代码有什么意义?
erqieshi 2012-07-06
  • 打赏
  • 举报
回复
问题解决了
谢谢大家回复帮助

使用的是#10楼的方法 至于#8以及#10楼最后的wmi还不知道怎么用
#9楼的方法本来很好,但是由于还有ATI的显卡所以有局限就没有采用
结贴
辰岡墨竹 2012-07-05
  • 打赏
  • 举报
回复

It works as follows:

(1) Find out the position of the current video device, information on this may be found in the registry, here:
\\HKLM\HARDWARE\DEVICEMAP\VIDEO\Device\Video0
There you will find a LPSTR type of entry, pointing to a registry key for the current video device, e.g.
"\Registry\Machine\System\ControlSet001\Services\G400\Device0"
(2) Parse that string, replacing "\Registry\Machine" with HKLM (HKEY_LOCAL_MACHINE) and open the corresponding registry key,
(3) Look for a DWORD value "Acceleration.Level". If the value does not exists, hardware acceleration is set to "Full". Otherwise, "Acceleration.Level" may be one of 0x1 to 0x5, 0x5 meaning "No Acceleration", and 0x1 meaning "All but cursor acceleration" (see "Extended Display Settings").
(4) Set the desired acceleration level, or delete the entry to set "Full" acceleration mode.
(5) Let Windows reload the display settings by using the following code:

DEVMODE devMode;
BOOL success = ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
if (success == TRUE)
{
LONG result = ::ChangeDisplaySettings(&devMode, CDS_RESET);
printf("ChangeDisplaySettings() returned: %d\n", result);
}

First, the current display settings are loaded into the devMode variable, and then, the displayed is forced to perform a reset; at this occasion, the "Acceleration.Level" value is read out from the registry and the new acceleration level is set.

不过使用WMI比修改注册表要好很多,可以参考这段VBS:
http://www.edugeek.net/wiki/index.php?title=Set_Hardware_Acceleration_Level
zwfgdlc 2012-07-04
  • 打赏
  • 举报
回复
去NVIDIA网站下载控制面板nvcpl.dll里的API说明文档吧.
应该有这样的API.
erqieshi 2012-07-04
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]

用regmon监视dxdiag设置打开/关闭硬件加速时修改的注册表项?
[/Quote]
我要做安装包能够关闭客户的机子上的硬件加速,或者程序运行时关闭,要能适应不同机子
避免要客户手动去关闭
而不是为了找硬件加速对应的注册表项
不过还是谢谢赵老师前辈的回复支持
赵4老师 2012-07-04
  • 打赏
  • 举报
回复
用regmon监视dxdiag设置打开/关闭硬件加速时修改的注册表项?
erqieshi 2012-07-04
  • 打赏
  • 举报
回复
是的键值项是Acceleration.Level
是5的时候关闭
0的时候是全速
但是所在注册表的位置在不同电脑上都不同
erqieshi 2012-07-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

通过修改注册表,可以实现关闭硬件加速~
[/Quote]
硬件加速的注册表项在不同电脑上的几乎全部不同
比如我这边的一台电脑在
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ialm\Device0]
另有
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{********-****-****-****-************}\000]
lqfcu2 2012-07-04
  • 打赏
  • 举报
回复
关硬件加速,我记得应该是固定的一个键值啊~~代码在家里电脑上,具体记不清了~~
lqfcu2 2012-07-04
  • 打赏
  • 举报
回复
通过修改注册表,可以实现关闭硬件加速~
tcige 2012-07-04
  • 打赏
  • 举报
回复
这种都是用wmi的

修改注册表最没技术含量了

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧