中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 登陆资料
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 未整理篇 | 技术讨论
通过WMI获得硬盘和CPU的物理序列号
作者:未知 时间:2004-11-09 12:12 出处:互联网 责编:chinaitpower
              摘要:暂无
''获得硬盘序列号


Dim cmicWmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")



Dim Uint32 As UInt32


For Each cmicWmiObj As ManagementObject In cmicWmi.Get


Uint32 = cmicWmiObj("signature")


Next


TextBox1.Text = Uint32.ToString




''获得CPU序列号


Dim Wmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_Processor")



Dim Uint32 As String


For Each WmiObj As ManagementObject In Wmi.Get


Uint32 = WmiObj("ProcessorId")


Next


TextBox1.Text = Uint32



''获得硬盘总容量


Dim Wmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")



Dim Uint64 As UInt64


For Each WmiObj As ManagementObject In Wmi.Get


Uint64 = WmiObj("size")


Next


TextBox1.Text = Uint64.ToString


首先,引用System.Management;然后在代码中Imports System.Management;


 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有