C# Bilgisayara Kurulu İşletim Sistemin Seri Numarasını ve CPU(işlemci)’nun Kimliğini Gösteren Program
Not:Öncelikler Add Referencedeki .Net Sekmesinden System.Managament'i ekliyoruz...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace cpu_kimligi_ve_isletim
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private List<string> SistemSeriNo()
{
List<string> liste = new List<string>();
string query = "SELECT * FROM Win32_BaseBoard";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject info in searcher.Get())
{
liste.Add(info.GetPropertyValue("SerialNumber").ToString());
}
return liste;
}
private List<string> CpuKimlik()
{
List<string> liste = new List<string>();
string query = "Select * FROM Win32_Processor";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject info in searcher.Get())
{
liste.Add(
info.GetPropertyValue("ProcessorId").ToString());
}
return liste;
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.DataSource = CpuKimlik();
listBox2.DataSource = SistemSeriNo();
}
}
}
0 yorum:
Yorum Gönder