• 大小: 62KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: C#  电脑  

资源简介

C# Windows 系统一键查询如下电脑信息,方便快捷,有源码,可以直接运行。全网本类别最全的下载资源。 1.cpu序列号 2.mac序列号 3.硬盘id 4.ip地址 5.登录用户名 6.计算机名 7.系统类型 8.内存量 单位:M 9.硬盘卷标号 10.获取BIOS序列号

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QueryPCInfos
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {

        }

        private void button1_Click(object sender EventArgs e)
        {
            string myStr = ““;
            this.textBox1.Text = ““;
            myStr += “CPU型号:“ + Computer.CpuID.ToString() + “\r\n“;
            myStr += “硬盘型号:“ + Computer.DiskID.ToString()+“\r\n“;
            myStr += “硬盘卷标号:“ + Computer.DiskVolumeSerialNumber.ToString() + “\r\n“;
            myStr += “BIOS序列号:“ + Computer.BIOSSerialNumber.ToString() + “\r\n“;
            
            
            this.textBox1.Text = myStr;

        }
    }

    public class Computer
    {
        public static string CpuID; //1.cpu序列号
        public static string MacAddress; //2.mac序列号
        public static string DiskID; //3.硬盘id
        public static string IpAddress; //4.ip地址
        public static string LoginUserName; //5.登录用户名
        public static string ComputerName; //6.计算机名
        public static string SystemType; //7.系统类型
        public static string TotalPhysicalMemory; //8.内存量 单位:M
        public static string DiskVolumeSerialNumber; //9.硬盘卷标号
        public static string BIOSSerialNumber; //获取BIOS序列号

        

        static Computer()
        {
            CpuID = getCpu();
            MacAddress = GetMacAddress();
            DiskID = GetDiskID();
            IpAddress = GetIPAddress();
            LoginUserName = GetUserName();
            SystemType = GetSystemType();
            TotalPhysicalMemory = GetTotalPhysicalMemory();
            ComputerName = GetComputerName();
            DiskVolumeSerialNumber = GetDiskVolumeSerialNumber();
            BIOSSerialNumber = getBIOSSerialNumber();

        }

        //1.获取CPU序列号代码 

        static string GetCpuID()
        {
            try
            {
                string cpuInfo = ““;//cpu序列号 
                ManagementClass mc = new ManagementClass(“Win32_Processor“);
                ManagementobjectCollection moc = mc.GetInstances();
                foreach (Managementobject mo in moc)
                {
                    cpuInfo = mo.Properties[“ProcessorId“].Value.ToString();
                }
                moc = null;
                mc = null;
                return cpuInfo;
            }
            catch
            {
                return “unknow“;
            }
            finally
            {
            }

        }

        //2.获取网卡硬件地址 

        static string GetMacAddress()
        {
            try
            {
                strin

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        187  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\App.config

     文件      12288  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\bin\Debug\QueryPCInfos.exe

     文件        187  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\bin\Debug\QueryPCInfos.exe.config

     文件      30208  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\bin\Debug\QueryPCInfos.pdb

     文件      23168  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\bin\Debug\QueryPCInfos.vshost.exe

     文件        187  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\bin\Debug\QueryPCInfos.vshost.exe.config

     文件        187  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\bin\Debug\WindowsFormsApplication1.vshost.exe.config

     文件        490  2010-03-17 22:39  QueryPCInfos\QueryPCInfos\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件       9445  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\Form1.cs

     文件       2802  2017-12-29 15:06  QueryPCInfos\QueryPCInfos\Form1.Designer.cs

     文件       5817  2017-12-29 14:43  QueryPCInfos\QueryPCInfos\Form1.resx

     文件       1453  2017-12-29 14:48  QueryPCInfos\QueryPCInfos\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7473  2017-12-29 15:05  QueryPCInfos\QueryPCInfos\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1160  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.csproj.FileListAbsolute.txt

     文件        977  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.csproj.GenerateResource.Cache

     文件      12288  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.exe

     文件        180  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.Form1.resources

     文件      30208  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.pdb

     文件        180  2017-12-29 16:38  QueryPCInfos\QueryPCInfos\obj\Debug\QueryPCInfos.Properties.Resources.resources

     文件          0  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       4608  2017-12-29 15:05  QueryPCInfos\QueryPCInfos\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件       1437  2017-12-29 14:34  QueryPCInfos\QueryPCInfos\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt

     文件        977  2017-12-29 12:02  QueryPCInfos\QueryPCInfos\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache

     文件       2531  2017-12-29 12:02  QueryPCInfos\QueryPCInfos\obj\Debug\WindowsFormsApplication1.csprojResolveAssemblyReference.cache

     文件        524  2017-12-29 15:06  QueryPCInfos\QueryPCInfos\Program.cs

     文件       1372  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\Properties\AssemblyInfo.cs

     文件       2864  2017-12-29 15:05  QueryPCInfos\QueryPCInfos\Properties\Resources.Designer.cs

     文件       5612  2017-12-29 11:49  QueryPCInfos\QueryPCInfos\Properties\Resources.resx

............此处省略18个文件信息

评论

共有 条评论