惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
S
Securelist
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
T
Threatpost
H
Heimdal Security Blog
W
WeLiveSecurity
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
TaoSecurity Blog
TaoSecurity Blog
A
About on SuperTechFans
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
量子位
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security

博客园 - 星期六

批量替换文本文件中的字符 获取主板及硬盘序列号 - 星期六 - 博客园 .net安装部署“Error 1001 在初始化安装时发生异常” 的解决方法 解决.net绘制的 WinForm 在 windows7下变形的方法。 如何使用 Visual C# 加密和解密文件 ppc通过蓝牙与电脑同步时无ActiveSync服务的解决方法。 winfrom中的几个界面皮肤控件 如何弹出一个模式窗口来显示进度条 .net 实现移动控件位置 如何在安装后自动运行程序? 调试自定义操作/安装程序类的方法 利用TimerCallback实现timer传递参数 网页中下载灰鸽子病毒的 SCRIPT 一段控制对象透明度的style. ASP.net 把 DataGrid 数据导出到 Excel . 用C#实现语音技术 ASP.NET 用读取二进制代码的方法在页面上显示指定图片。 c# 8条语句实现屏幕抓图 几条SQLl查询语句
C# winform授权:获取cpu和硬盘的序列号,得到机器码
星期六 · 2011-06-17 · via 博客园 - 星期六
C# winform授权:获取cpu和硬盘的序列号,得到机器码

 1 首先在添加引用中选中System.Management
 2 再在开始部门:
 3 using System.Management;
 4 using System.Management.Instrumentation;
 5 
 6 private void GetInfo()  
 7    {  
 8     string cpuInfo = "";//cpu序列号  
 9     ManagementClass cimobject = new ManagementClass("Win32_Processor");  
10     ManagementObjectCollection moc = cimobject.GetInstances();  
11     foreach(ManagementObject mo in moc)  
12     {  
13      cpuInfo = mo.Properties["ProcessorId"].Value.ToString();  
14      Response.Write ("cpu序列号:"+cpuInfo.ToString ());  
15     }  
16 
17     //获取硬盘ID  
18     String HDid;  
19     ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");  
20     ManagementObjectCollection moc1 = cimobject1.GetInstances();  
21     foreach(ManagementObject mo in moc1)  
22     {  
23      HDid = (string)mo.Properties["Model"].Value;  
24      Response.Write ("硬盘序列号:"+HDid.ToString ());  
25     }  
26 
27 
28     //获取网卡硬件地址  
29 
30      
31      
32     ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");  
33     ManagementObjectCollection moc2 = mc.GetInstances();  
34     foreach(ManagementObject mo in moc2)  
35     {  
36      if((bool)mo["IPEnabled"== true)  
37       Response.Write("MAC address\t{0}"+mo["MacAddress"].ToString());  
38      mo.Dispose();  
39     }  
40    }
41  
42 在添加引用中选中System.Management
43 再在开始部门:
44 using System.Management;
45 using System.Management.Instrumentation;
46 
47 private void GetInfo()  
48    {  
49     string cpuInfo = "";//cpu序列号  
50     ManagementClass cimobject = new ManagementClass("Win32_Processor");  
51     ManagementObjectCollection moc = cimobject.GetInstances();  
52     foreach(ManagementObject mo in moc)  
53     {  
54      cpuInfo = mo.Properties["ProcessorId"].Value.ToString();  
55      Response.Write ("cpu序列号:"+cpuInfo.ToString ());  
56     }  
57 
58     //获取硬盘ID  
59     String HDid;  
60     ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");  
61     ManagementObjectCollection moc1 = cimobject1.GetInstances();  
62     foreach(ManagementObject mo in moc1)  
63     {  
64      HDid = (string)mo.Properties["Model"].Value;  
65      Response.Write ("硬盘序列号:"+HDid.ToString ());  
66     }  
67 
68 
69     //获取网卡硬件地址  
70 
71      
72      
73     ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");  
74     ManagementObjectCollection moc2 = mc.GetInstances();  
75     foreach(ManagementObject mo in moc2)  
76     {  
77      if((bool)mo["IPEnabled"== true)  
78       Response.Write("MAC address\t{0}"+mo["MacAddress"].ToString());  
79      mo.Dispose();  
80     }  
81    } 

posted on 2011-06-17 14:11  星期六  阅读(4479)  评论()    收藏  举报