获取硬件标识
来源:互联网 发布:网络品牌注册怎么办理 编辑:程序博客网 时间:2024/05/18 11:25
通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
Delphi通过WMI获取系统信息
uses ActiveX, ComObj;
function GetWMIProperty(WMIType, WMIProperty: string): string;
var
Wmi, Objs, Obj: OleVariant;
Enum: IEnumVariant;
C: Cardinal;
begin
Wmi:= CreateOleObject('WbemScripting.SWbemLocator');
Objs := Wmi.ConnectServer('.','root/cimv2').ExecQuery('Select * from Win32_' + WMIType);
Enum := IEnumVariant(IUnknown(Objs._NewEnum));
Enum.Reset;
Enum.Next(1, Obj, C);
Obj := Obj.Properties_.Item(WMIProperty, 0).Value;
Result := Obj;
end;
// 获取硬盘序列号
ShowMessage(GetWMIProperty('DiskDrive', 'PNPDeviceID'));
// 获取BISO序列号
ShowMessage(GetWMIProperty('BIOS', 'SerialNumber'));
// 获取网卡MAC地址
ShowMessage(GetWMIProperty('NetworkAdapter', 'MACAddress'));
// 获取网卡序列号
ShowMessage(GetWMIProperty('NetworkAdapter', 'PNPDeviceID'));
// 获取CPU序列号
ShowMessage(GetWMIProperty('Processor', 'ProcessorId'));
也可以用同样的方法获得任意感兴趣的系统信息,比如正在运行的进程、账户信息等等。
更多WMI的信息参考:
http://www.microsoft.com/whdc/system/pnppwr/wmi/default.mspx
http://msdn2.microsoft.com/en-us/library/aa394572.aspx
Delphi通过WMI获取系统信息
uses ActiveX, ComObj;
function GetWMIProperty(WMIType, WMIProperty: string): string;
var
Wmi, Objs, Obj: OleVariant;
Enum: IEnumVariant;
C: Cardinal;
begin
Wmi:= CreateOleObject('WbemScripting.SWbemLocator');
Objs := Wmi.ConnectServer('.','root/cimv2').ExecQuery('Select * from Win32_' + WMIType);
Enum := IEnumVariant(IUnknown(Objs._NewEnum));
Enum.Reset;
Enum.Next(1, Obj, C);
Obj := Obj.Properties_.Item(WMIProperty, 0).Value;
Result := Obj;
end;
// 获取硬盘序列号
ShowMessage(GetWMIProperty('DiskDrive', 'PNPDeviceID'));
// 获取BISO序列号
ShowMessage(GetWMIProperty('BIOS', 'SerialNumber'));
// 获取网卡MAC地址
ShowMessage(GetWMIProperty('NetworkAdapter', 'MACAddress'));
// 获取网卡序列号
ShowMessage(GetWMIProperty('NetworkAdapter', 'PNPDeviceID'));
// 获取CPU序列号
ShowMessage(GetWMIProperty('Processor', 'ProcessorId'));
也可以用同样的方法获得任意感兴趣的系统信息,比如正在运行的进程、账户信息等等。
更多WMI的信息参考:
http://www.microsoft.com/whdc/system/pnppwr/wmi/default.mspx
http://msdn2.microsoft.com/en-us/library/aa394572.aspx
阅读全文
0 0
- 获取硬件标识
- net + c#获取客户端唯一标识(网卡硬件地址)
- 获取硬件
- 获取进程标识
- 获取Android 唯一标识
- 获取标识列
- 获取设备唯一标识
- 获取终端设备标识
- iOS获取唯一标识
- 应用获取唯一标识
- 获取设备唯一标识
- 获取手机唯一标识
- c# 获取计算机硬件标识
- 获取设备唯一标识
- 获取手机唯一标识码
- 【Android】获取设备标识号
- wince获取机身唯一标识
- 如何获取设备唯一标识
- ubuntu14 python 调用C++模块
- Oracle DB 组函数
- 向上转型、向下转型
- 203.m1-Game界面的实现
- nginx localtion 匹配规则
- 获取硬件标识
- C语言的const类型限定符
- 关于SQL优化:
- 【Linux开发】【CUDA开发】Ubuntu上安装NVIDIA显卡驱动
- caffe中使用python进行图像预测
- 如何快速下载DockerToolbox?Boot2Docker? 使用国内开源镜像站点
- 飞龙的程序员书单 – 数据结构、算法
- 关于sublime text3 汉化的方法
- nagios 安装配置