如何使用 C++ 在 Windows 中获取硬件信息?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4253164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:39:17  来源:igfitidea点击:

How to get hardware information in Windows using C++?

c++windowsvisual-studiowindows-xphardware-id

提问by M.Rezaei

How to get hardware information (for example cpuId, biosId, diskId, baseId and videoId) in c++?

如何在 C++ 中获取硬件信息(例如 cpuId、biosId、diskId、baseId 和 videoId)?

Can anyone give me an example visual studio project for this?

谁能给我一个 Visual Studio 项目的例子?

采纳答案by ur.

There are very different ways to get a disk id (serial number? volume id?) or a CPU ID or ... . I think you want to build a fingerprint of the computer. The most comfortable way is to use Windows Management Instrumentation (WMI) and access the DMI. See MSDNfor a start. See MSDN herefor a hint how to get the mainboard serial number as an example.

获取磁盘 ID(序列号?卷 ID?)或 CPU ID 或 ... 的方法有很多种。我想你想建立计算机的指纹。最舒适的方法是使用 Windows Management Instrumentation (WMI) 并访问DMI。请参阅MSDN开始。以获取主板序列号为例,请参见此处MSDN

回答by Steve Rowe

GetSystemInfowill get you started with the CPU information. Each subsystem generally has different query functions.

GetSystemInfo将帮助您了解 CPU 信息。每个子系统一般都有不同的查询功能。

回答by lj_enjoylife

The standard c++ don`t provide this for you. These api may be provided by os or hardware driver.

标准的 c++ 不为您提供这个。这些 api 可能由操作系统或硬件驱动程序提供。