Windows API 获取主板型号和名称
Posted
技术标签:
【中文标题】Windows API 获取主板型号和名称【英文标题】:Windows API to get Motherboard Model and Name 【发布时间】:2012-11-30 05:50:50 【问题描述】:我正在windows上编写一个应用程序来获取主板的信息。我要收集的信息是
主板制造商(例如戴尔或技嘉) 主板型号(例如 T3600 或 GA-Z77)谁能告诉我应该使用哪个 API 来获取这些信息?
【问题讨论】:
How to get computer manufacturer and model in C++?的可能重复 【参考方案1】:这是第一个答案,感谢您对本网站的感谢 首先将 System.Management 引用添加到您的项目 试试这个
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
namespace ConsoleApplication2
class Program
static void Main(string[] args)
// First we create the ManagementObjectSearcher that
// will hold the query used.
// The class Win32_BaseBoard (you can say table)
// contains the Motherboard information.
// We are querying about the properties (columns)
// Product and SerialNumber.
// You can replace these properties by
// an asterisk (*) to get all properties (columns).
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("SELECT Product, SerialNumber FROM Win32_BaseBoard");
// Executing the query...
// Because the machine has a single Motherborad,
// then a single object (row) returned.
ManagementObjectCollection information = searcher.Get();
foreach (ManagementObject obj in information)
// Retrieving the properties (columns)
// Writing column name then its value
foreach (PropertyData data in obj.Properties)
Console.WriteLine("0 = 1", data.Name, data.Value);
Console.WriteLine();
// For typical use of disposable objects
// enclose it in a using statement instead.
searcher.Dispose();
Console.Read();
希望对你有所帮助
【讨论】:
以上是关于Windows API 获取主板型号和名称的主要内容,如果未能解决你的问题,请参考以下文章