hi how i view hardware in c# ?
example:
view my name of my Graphic Card?
View hardware
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Dec 28, 2007, 12:12 AM EST
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);
}
}
}
}
oshri ggg3 reputationPosted Dec 28, 2007, 12:29 AM EST
http://img242.imageshack.us/img242/7796/fgdfgfdgfdgd1.gif