在 C# 中获取视频适配器的硬件 GUID
我正在为 Windows 上的 3D 游戏开发启动器应用程序。配置“ini”文件要求用户指定所需设备的硬件 GUID,如 dxdiag.exe 返回的设备标识符 GUID。
我试图列出系统上可用的适配器,允许用户选择一个并将该设备的硬件 GUID 加载到 ini 文件中。
我已经研究了许多方法来尝试这一点。我尝试使用 System.Management 类,它返回类 GUID,但不返回特定的驱动程序 GUID。我尝试使用对SetupAPI.h函数的本机调用,这似乎也无法列出特定的设备标识符GUID。我尝试检查注册表,看看 GUID 是否驻留在其中。运气不好。
我最好的想法可能是使用 Managed DirectX 库返回我正在寻找的 GUID,考虑到 dxdiag 可能就是这样做的。我能够使用 .NET 应用程序的 SharpDX Managed DirectX 接口(我的目标是框架 3.5)枚举和收集有关每个驱动程序的硬件信息,但同样,我无法返回 dxdiag 返回的相同 GUID。
我真的很想找到解决方案。帮助?
I'm developing a launcher application for a 3D game on Windows. The configuration "ini" file requires the user to specify the hardware GUID for the desired device, as in, the Device Identifier GUID returned by dxdiag.exe.
I'm trying to list the available adapters on the system, allow the user to select one and load that device's hardware GUID into the ini file.
I've examined many methods for attempting this. I've tried using the System.Management class, which returns the class GUID but not the specific driver GUID. I've tried using native calls to SetupAPI.h functions, which also seem to not be able to list the specific Device Identifier GUID. I've tried examining the registry, to see if the GUID resides there. No luck.
My best idea was probably using the Managed DirectX library to return the GUID I'm looking for, considering that's probably how dxdiag does it. I was able to enumerate and collect hardware information about each driver using the SharpDX Managed DirectX interface for .NET applications (I'm targeting framework 3.5), but again, I wasn't able to return the same GUID that dxdiag returns.
I'm really stuck for a solution. Help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自己设法解决了。
决定解决此问题的最佳方法是使用 DirectX。导入 DX 库,将我的应用程序更改为 x86。我正在寻找的代码是:
Managed to solve it myself.
Decided the best way to solve this was using DirectX. Imported DX libraries, changed my app to x86. The code I was looking for was: