hi how i view hardware in c# ?
example:
view my name of my Graphic Card?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
oshri gggPosted Dec 28, 2007, 5:29 AM
http://img242.imageshack.us/img242/7796/fgdfgfdgfdgd1.gif
Scott LyslePosted Dec 28, 2007, 5:12 AM
Using System.Management along with the WMI Code Creator (download it here http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en)
using System;
using System.Management;
using System.Windows.Forms;
namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_VideoController");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_VideoController instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("VideoProcessor: {0}", queryObj["VideoProcessor"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
}
}
}