如何使用 C++ 获取显示适配器卡的内存大小?
我想获取显示适配器卡的内存大小。最好的方法是什么?
我的开发环境是Visual Studio C++ 2008。
谢谢。
I would like to get the display adapter card memory size. What is the best way to do this?
My development enviroment is Visual Studio C++ 2008.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
获得此信息的(更简单且统一的)方法之一是通过 WMI 或 Windows 管理工具。
例如,通过 WMI
非编程方式
查看它。1. 打开
运行> wbem测试>按 Enter 键。这将打开 WMI 窗口。
2. 点击
连接>在已有 root\default > 的框中输入 root\cimv2推动连接。
3. 点击
查询>输入查询为 Select * from Win32_VideoController >申请>双击返回的值
。这将打开一个窗口,其中包含有关您的显卡的信息。4. 在对象编辑器窗口中,检查
AdapterRam
字段,其中包含图形卡 RAM(以字节为单位)。现在,要在 VC++ 中以编程方式执行此操作,您需要访问 WMI 提供程序的 API。您可以在此处找到示例。
希望有帮助。
One of the (easier and uniform) ways of getting this is through WMI or windows management instrumentation.
E.g. to view it
non programatically
through WMI.1. Open
Run > wbemtest > press enter
. This will bring up the WMI window.2. Click
Connect > enter root\cimv2 into the box that has already root\default > push Connect.
3. Click on
Query > Enter query as Select * from Win32_VideoController > Apply > double click the value
returned. This will bring up a window with information about your graphics card.4. In the object editor window check the field
AdapterRam
which has the graphics card RAM in bytes.Now to programatically do this in VC++, you need to access APIs of the WMI provider. You'll find an example here.
Hope that helps.
考虑您正在使用的图形库...确定安装的视频内存的难度将取决于库。有些库不提供这方面的方法。也许获取已安装视频内存的最简单的库是 SDL...
http://www. libsdl.org/cgi/docwiki.cgi/SDL_VideoInfo
Consider the graphics library you are using... the difficulty of determining the installed video memory will depend on the library. Some libraries do not provide methods for this. Perhaps the easiest library to get the installed video memory is SDL...
http://www.libsdl.org/cgi/docwiki.cgi/SDL_VideoInfo