Hello World

C#(WINFORM, WINCE, WINDOWS MOBILE) 실전 활용 예제소스 및 프로그램 개발

[C#]CPU, Graphic, Memory 정보 얻기 예제

댓글 0

C#

2016. 10. 25.

using System.Management;

//CPU 이름 얻기
ManagementObjectSearcher win32Proc = new ManagementObjectSearcher("select * from Win32_Processor");

foreach (ManagementObject obj in win32Proc.Get())
{
    string procName = obj["Name"].ToString();
}

//GRAPHIC 카드 이름 얻기
ManagementObjectSearcher win32Display = new ManagementObjectSearcher("select * from Win32_DisplayConfiguration")

foreach (ManagementObject obj in win32Display.Get())
{
    string grpName = obj["Description"].ToString();
}

//메모리 용량 얻기
ManagementObjectSearcher win32CompSys = new ManagementObjectSearcher("select * from Win32_ComputerSystem")

foreach (ManagementObject obj in win32CompSys.Get())
{
    string memName = obj["totalphysicalmemory"].ToString();
}