DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: jeff1314
今日帖子: 0
在线用户: 5
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 mricy (Icy) ▲▲▲▲△ -
普通会员
2016/12/19 12:10:41
标题:
一个读取硬盘驱动器序列号的 浏览:2633
加入我的收藏
楼主: 这个是我在修改某个项目时的,做个单文件给delphi调用看看。
一个读取硬盘驱动器序列号的功能的 DLL Delphi 调用端.
一个简单的查看 硬盘驱动器信息 
还有一个导出函数 读取硬盘序列号.
CSDN http://download.csdn.net/detail/icysoft/9714904

http://icy6.com/icysoft/79.html
此帖子包含附件:
PNG 图像
大小:45.5K
----------------------------------------------
哦哟喂,看过来: http://zelig.cn
作者:
男 jccddd (jcd) ★☆☆☆☆ -
普通会员
2016/12/19 13:19:49
1楼: 我的2t硬盘,只显示400多G的大小。
----------------------------------------------
-上帝给我们的脑子编程,我们给电脑编程,可上帝却始终站在电脑一边...
作者:
男 mricy (Icy) ▲▲▲▲△ -
普通会员
2016/12/19 13:38:26
2楼: 那是,格式化大小范围。。。。。。。。。。 哈哈 2T的没用过呢 
我的才256  台机的 才512  。。。。。。。。
----------------------------------------------
哦哟喂,看过来: http://zelig.cn
作者:
男 dongcijie (dongcijie) ★☆☆☆☆ -
普通会员
2016/12/19 14:51:51
3楼: 对阵列有效吗?
----------------------------------------------
-
作者:
男 hsj (hsj) ★☆☆☆☆ -
盒子活跃会员
2016/12/20 10:00:36
4楼: jyDisk.DLL 是一个标准的Windows动态链接库,它能够让您在你的程序中简单地获取硬盘出厂序列号。 jyDisk.DLL可以应用于各种流行的开发语言,比如Delphi, C++Builder, C#, Visual C++, Visual Basic, Visual Basic.NET, PowerBuilder等,示例为delphi7调用代码和c#调用代码. 
jyDisk.DLL特性
1.支持windows2000,xp及以上系统,支持64位操作系统,支持U盘/移动硬盘,不支持win98及以下操作系统。
2.仅需1个dll文件。
3.在win7/win8等系统下,无需管理员权限。
4.支持根据盘符获取硬盘的物理序号,支持获取磁盘类型。
5.支持获取硬盘温度、smart信息
下载地址:http://www.dxmylove.com/download/jyharddisk.zip
支持移动硬盘,阵列哦
----------------------------------------------
qq:171833017,靖源软件http://www.dxmylove.com
作者:
男 wang_80919 (Flying Wang) ★☆☆☆☆ -
普通会员
2016/12/20 10:01:35
5楼: 你们俩 谁免费?
是提供源码?
----------------------------------------------
(C)(P)Flying Wang
作者:
男 mricy (Icy) ▲▲▲▲△ -
普通会员
2016/12/20 10:59:03
6楼: 我的不要钱,就是给Delphi 调用玩玩的。
全导出 一小小部分。。。。
人家是卖钱的 我不是。。。
----------------------------------------------
哦哟喂,看过来: http://zelig.cn
作者:
男 fb4819 (方明) ★☆☆☆☆ -
盒子活跃会员
2016/12/20 11:12:31
7楼: DLL也开源吧...
要不背着个DLL麻烦
----------------------------------------------
vvvvvvvvvv
作者:
男 kylix2008 (kylix2008) ★☆☆☆☆ -
普通会员
2016/12/20 19:14:57
8楼: 无源码的,不用
----------------------------------------------
-
作者:
男 terony (圣光) ★☆☆☆☆ -
盒子活跃会员
2016/12/28 10:09:52
9楼: 楼主Low了,我有Delphi源码的,而且很多Delphier都有,都用多少年了。。。。。。
----------------------------------------------
-
作者:
男 bmsr (白忙剩人) ★☆☆☆☆ -
普通会员
2016/12/28 15:54:58
10楼: 晕!这个不是很简单的东西吗?
//---------WMI----------
type
  Rec_Wmi = record
    ComputerName: string;
    Namespace: string;
    User: string;
    Password: string;
    WMIType: string;
    Enum: IEnumVariant;
    class function GetWmiEnum(WMIType: string; var AEnum: IEnumVariant; Namespace: string = 'root\cimv2';
      Where: string = ''; ComputerName: string = ''; User: string = ''; Password: string = ''): string; static;
    class function GetWMIProperty(Enum: IEnumVariant; WMIProperty: string; Index: integer = 0): OleVariant; static;
    class function SetWMIProperty(Enum: IEnumVariant; WMIProperty: string; value: string; Index: integer = 0): string; static;
    function GetEnum(Where: string = ''): string;
    function GetProperty(WMIProperty: string; Index: integer = 0): OleVariant;
    function SetProperty(WMIProperty: string; value: string): string;
  end;


{ Rec_Wmi }

function Rec_Wmi.GetEnum(Where: string): string;
begin
  if Self.ComputerName = '' then Self.ComputerName := '.';
  if Self.Namespace = '' then Self.Namespace := 'root\cimv2';
  Result := GetWmiEnum(Self.WMIType, Self.Enum, Self.Namespace, Where, Self.ComputerName, Self.User, Self.Password);
end;

function Rec_Wmi.GetProperty(WMIProperty: string; Index: integer): OleVariant;
begin
  Result := TrueStr;
  if VarIsNull(Self.Enum) then Result := Self.GetEnum;
  if Result <> TrueStr then exit('');
  Result := Self.GetWMIProperty(Self.Enum, WMIProperty, Index);
end;

class function Rec_Wmi.GetWmiEnum(WMIType: string; var AEnum: IEnumVariant; Namespace, Where, ComputerName, User, Password: string): string;
var
  Wmi, Objs : OleVariant;
  sql: string;
begin
  Result := FalseStr;
  try
    if Where = '' then sql := 'Select * from ' + WMIType
    else sql := 'Select * from ' + WMIType + ' where ' + Where;
    if ComputerName = '' then ComputerName := '.';
    Wmi := CreateOleObject('WbemScripting.SWbemLocator');
    if (User <> '') and (Password <> '') then Objs := Wmi.ConnectServer(ComputerName, Namespace, User, Password).ExecQuery(sql)
    else Objs := Wmi.ConnectServer(ComputerName, Namespace).ExecQuery(sql);
    if VarIsNull(Objs) then exit('未找到 ' + WMIType);
    AEnum := IEnumVariant(IUnknown(Objs._NewEnum));
    Result := TrueStr;
  except
    on E: Exception do Result := E.Message;
  end;

end;

class function Rec_Wmi.GetWMIProperty(Enum: IEnumVariant; WMIProperty: string; Index: integer): OleVariant;
var
  obj: OleVariant;
  C: Cardinal;
  i: integer;
  hr: HResult;
begin
  Result := null;
  try
    Enum.Reset;
    i := 0;
    while i <= index do
      begin
        hr := Enum.Next(1, obj, C);
        inc(i);
      end;
    if (hr = S_OK) then Result := obj.Properties_.Item(WMIProperty, 0).value;
  except
    on E: Exception do Result := '';
  end;
end;

function Rec_Wmi.SetProperty(WMIProperty, value: string): string;
begin
  Result := TrueStr;
  if VarIsNull(Self.Enum) then Result := Self.GetEnum;
  Result := Self.SetWMIProperty(Self.Enum, WMIProperty, value);

end;

class function Rec_Wmi.SetWMIProperty(Enum: IEnumVariant; WMIProperty, value: string; Index: integer): string;
var
  obj: OleVariant;
  C: Cardinal;
  i: integer;
  hr: HResult;
begin
  Result := FalseStr;
  try
    Enum.Reset;
    i := 0;
    while i <= Index do
      begin
        hr := Enum.Next(1, obj, C);
        inc(i);
      end;
    if (hr = S_OK) then
      begin
        obj.Properties_.Item(WMIProperty, 0).value := value;
        obj.Put_;
      end;
    Result := TrueStr;
  except
    on E: Exception do Result := E.Message;
  end;

end;
以上代码都是查阅微软文档后自己写的

测试程序

procedure TForm_Main.Button3Click(Sender: TObject);
var
  Awmi: Rec_Wmi;
  devIndex: integer;
  arrstr: array of string;
  i: integer;
  ov: OleVariant;
begin
  Memo_Info.Lines.Clear;
  if Edit_Device_ID.text = '' then devIndex := 0
  else devIndex := StrToInt(Edit_Device_ID.text);
  Awmi.ComputerName := Edit_Database.text;
  Awmi.User := Edit_User_Name.text;
  Awmi.Password := Edit_PassWord.text;
  Memo_Info.Lines.Add('-----物理设备--------');
  Awmi.WMIType := 'Win32_PhysicalMedia';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum);
  Memo_Info.Lines.Add('PhysicalMedia Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('PhysicalMedia SerialNumber :' + vartostr(Awmi.GetProperty('SerialNumber', devIndex)));
  Memo_Info.Lines.Add('PhysicalMedia Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('PhysicalMedia Name :' + vartostr(Awmi.GetProperty('Name', devIndex)));

  Memo_Info.Lines.Add('------物理盘-------');
  Awmi.WMIType := 'Win32_DiskDrive';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum);
  Memo_Info.Lines.Add('Win32_DiskDrive PNPDeviceID :' + vartostr(Awmi.GetProperty('PNPDeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskDrive SerialNumber :' + vartostr(Awmi.GetProperty('SerialNumber', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskDrive Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskDrive DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskDrive Name :' + vartostr(Awmi.GetProperty('Name', devIndex)));
  //  Memo_Info.Lines.Add('Win32_DiskDrive CapabilityDescriptions :' + Awmi.GetProperty('CapabilityDescriptions'));
  Memo_Info.Lines.Add('Win32_DiskDrive MediaType :' + vartostr(Awmi.GetProperty('MediaType', devIndex)));

  Memo_Info.Lines.Add('------磁盘分区-------');
  Awmi.WMIType := 'Win32_DiskPartition';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum); //(' DeviceID =''Z:'''));
  Memo_Info.Lines.Add('Win32_DiskPartition Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition Name :' + vartostr(Awmi.GetProperty('Name', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition Description :' + vartostr(Awmi.GetProperty('Description')));
  Memo_Info.Lines.Add('Win32_DiskPartition DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition DiskIndex :' + vartostr(Awmi.GetProperty('DiskIndex', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition Index :' + vartostr(Awmi.GetProperty('Index', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition PNPDeviceID :' + vartostr(Awmi.GetProperty('PNPDeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition Purpose :' + vartostr(Awmi.GetProperty('Purpose', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition Size :' + vartostr(Awmi.GetProperty('Size', devIndex)));
  Memo_Info.Lines.Add('Win32_DiskPartition SystemName :' + vartostr(Awmi.GetProperty('SystemName', devIndex)));

  Memo_Info.Lines.Add('------逻辑盘-------');
  Awmi.WMIType := 'Win32_LogicalDisk';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum); //(' DeviceID =''Z:'''));
  Memo_Info.Lines.Add('Win32_LogicalDisk PNPDeviceID :' + vartostr(Awmi.GetProperty('PNPDeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_LogicalDisk Size :' + vartostr(Awmi.GetProperty('Size')));
  Memo_Info.Lines.Add('Win32_LogicalDisk DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_LogicalDisk VolumeName :' + vartostr(Awmi.GetProperty('VolumeName', devIndex)));
  Memo_Info.Lines.Add('Win32_LogicalDisk VolumeSerialNumber :' + vartostr(Awmi.GetProperty('VolumeSerialNumber', devIndex)));

  Memo_Info.Lines.Add('-----主板--------');
  Awmi.WMIType := 'Win32_BaseBoard';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum);
  Memo_Info.Lines.Add('Win32_BaseBoard SerialNumber :' + vartostr(Awmi.GetProperty('SerialNumber')));
  Memo_Info.Lines.Add('Win32_BaseBoard InstallDate :' + vartostr(Awmi.GetProperty('InstallDate')));
  Memo_Info.Lines.Add('Win32_BaseBoard Product :' + vartostr(Awmi.GetProperty('Product')));
  Memo_Info.Lines.Add('Win32_BaseBoard Manufacturer :' + vartostr(Awmi.GetProperty('Manufacturer')));
  Memo_Info.Lines.Add('Win32_BaseBoard Caption :' + vartostr(Awmi.GetProperty('Caption')));
  Memo_Info.Lines.Add('Win32_BaseBoard CreationClassName :' + vartostr(Awmi.GetProperty('CreationClassName')));
  Memo_Info.Lines.Add('Win32_BaseBoard Model :' + vartostr(Awmi.GetProperty('Model')));
  Memo_Info.Lines.Add('Win32_BaseBoard Name :' + vartostr(Awmi.GetProperty('Name')));
  Memo_Info.Lines.Add('Win32_BaseBoard PartNumber :' + vartostr(Awmi.GetProperty('PartNumber')));
  Memo_Info.Lines.Add('Win32_BaseBoard SlotLayout :' + vartostr(Awmi.GetProperty('SlotLayout')));
  Memo_Info.Lines.Add('Win32_BaseBoard Version :' + vartostr(Awmi.GetProperty('Version')));
  Memo_Info.Lines.Add('Win32_BaseBoard SKU :' + vartostr(Awmi.GetProperty('SKU')));
  Memo_Info.Lines.Add('Win32_BaseBoard OtherIdentifyingInfo :' + vartostr(Awmi.GetProperty('OtherIdentifyingInfo')));
  Memo_Info.Lines.Add('Win32_BaseBoard CreationClassName :' + vartostr(Awmi.GetProperty('CreationClassName')));

  Memo_Info.Lines.Add('-----BIOS--------');
  Awmi.WMIType := 'Win32_BIOS';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum);
  Memo_Info.Lines.Add('Win32_BIOS SerialNumber :' + vartostr(Awmi.GetProperty('SerialNumber')));
  Memo_Info.Lines.Add('Win32_BIOS TargetOperatingSystem :' + vartostr(vartostr(Awmi.GetProperty('TargetOperatingSystem'))));
  Memo_Info.Lines.Add('Win32_BIOS Manufacturer :' + vartostr(Awmi.GetProperty('Manufacturer')));
  Memo_Info.Lines.Add('Win32_BIOS BuildNumber :' + vartostr(Awmi.GetProperty('BuildNumber')));
  Memo_Info.Lines.Add('Win32_BIOS InstallDate :' + vartostr(Awmi.GetProperty('InstallDate')));
  Memo_Info.Lines.Add('Win32_BIOS ReleaseDate :' + vartostr(Awmi.GetProperty('ReleaseDate')));
  Memo_Info.Lines.Add('Win32_BIOS Version :' + vartostr(Awmi.GetProperty('Version')));
  Memo_Info.Lines.Add('Win32_BIOS CodeSet :' + vartostr(Awmi.GetProperty('CodeSet')));
  Memo_Info.Lines.Add('Win32_BIOS BIOSVersion :');
  ov := Awmi.GetProperty('CodeSet');
  if not VarIsNull(ov) then
    begin
      if VarIsArray(ov) then
        begin
          for i := VarArrayLowBound(ov, 1) to VarArrayHighBound(ov, 1) do
          begin
          Memo_Info.Lines.Add(vartostr(VarArrayGet(ov, [i])));
          end;
        end
    end;

  Memo_Info.Lines.Add('-----网卡--------');
  Awmi.WMIType := 'Win32_NetworkAdapter';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum('AdapterTypeID=0'));
  Memo_Info.Lines.Add('Win32_NetworkAdapter AdapterType :' + vartostr(Awmi.GetProperty('AdapterType', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter name :' + vartostr(Awmi.GetProperty('name', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter MACAddress :' + vartostr(Awmi.GetProperty('MACAddress', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter GUID :' + vartostr(Awmi.GetProperty('GUID', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter Index :' + vartostr(Awmi.GetProperty('Index', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter InterfaceIndex :' + vartostr(Awmi.GetProperty('InterfaceIndex', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter Manufacturer :' + vartostr(Awmi.GetProperty('Manufacturer', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter MaxSpeed :' + vartostr(vartostr(Awmi.GetProperty('MaxSpeed', devIndex))));
  Memo_Info.Lines.Add('Win32_NetworkAdapter Speed :' + vartostr(Awmi.GetProperty('Speed', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter NetConnectionStatus :' + vartostr(Awmi.GetProperty('NetConnectionStatus', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter PNPDeviceID :' + vartostr(Awmi.GetProperty('PNPDeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter ProductName :' + vartostr(Awmi.GetProperty('ProductName', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter ServiceName :' + vartostr(Awmi.GetProperty('ServiceName', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter SystemName :' + vartostr(Awmi.GetProperty('SystemName', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter PermanentAddress :' + vartostr(Awmi.GetProperty('PermanentAddress', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapter NetworkAddresses :');
  ov := Awmi.GetProperty('NetworkAddresses', devIndex);
  if not VarIsNull(ov) then
    begin
      if VarIsArray(ov) then
        begin
          for i := VarArrayLowBound(ov, 1) to VarArrayHighBound(ov, 1) do
          begin
          Memo_Info.Lines.Add(vartostr(VarArrayGet(ov, [i])));
          end;
        end
    end;
  Memo_Info.Lines.Add('-----网卡设置--------');
  Awmi.WMIType := 'Win32_NetworkAdapterConfiguration';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum('IPEnabled=True'));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration Properties :' + vartostr(Awmi.GetProperty('Properties', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration DNSDomain :' + vartostr(Awmi.GetProperty('DNSDomain', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration DNSHostName :' + vartostr(Awmi.GetProperty('DNSHostName', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration Index :' + vartostr(Awmi.GetProperty('Index', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration InterfaceIndex :' + vartostr(Awmi.GetProperty('InterfaceIndex', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration MACAddress :' + vartostr(Awmi.GetProperty('MACAddress', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration ServiceName :' + vartostr(Awmi.GetProperty('ServiceName', devIndex)));
  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration DefaultIPGateway :');
  ov := Awmi.GetProperty('DefaultIPGateway', devIndex);
  if not VarIsNull(ov) then
    begin
      if VarIsArray(ov) then
        begin
          for i := VarArrayLowBound(ov, 1) to VarArrayHighBound(ov, 1) do
          begin
          Memo_Info.Lines.Add(vartostr(VarArrayGet(ov, [i])));
          end;
        end
    end;

  Memo_Info.Lines.Add('Win32_NetworkAdapterConfiguration IPAddress :');
  ov := (Awmi.GetProperty('IPAddress', devIndex));
  if not VarIsNull(ov) then
    begin
      if VarIsArray(ov) then
        begin
          for i := VarArrayLowBound(ov, 1) to VarArrayHighBound(ov, 1) do
          begin
          Memo_Info.Lines.Add(vartostr(VarArrayGet(ov, [i])));
          end;
        end
    end;

  Memo_Info.Lines.Add('-----CPU--------');
  Awmi.WMIType := 'Win32_Processor';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum); //('IPEnabled=True'));
  Memo_Info.Lines.Add('Win32_Processor ProcessorId :' + vartostr(Awmi.GetProperty('ProcessorId', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor SerialNumber :' + vartostr(Awmi.GetProperty('SerialNumber', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor Version :' + vartostr(Awmi.GetProperty('Version', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor UniqueId :' + vartostr(Awmi.GetProperty('UniqueId', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor SystemName :' + vartostr(Awmi.GetProperty('SystemName', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor Name :' + vartostr(Awmi.GetProperty('Name', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor CreationClassName :' + vartostr(Awmi.GetProperty('CreationClassName', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor Manufacturer :' + vartostr(Awmi.GetProperty('Manufacturer', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor NumberOfCores :' + vartostr(Awmi.GetProperty('NumberOfCores', devIndex)));
  Memo_Info.Lines.Add('Win32_Processor ThreadCount :' + vartostr(Awmi.GetProperty('ThreadCount', devIndex)));

  Memo_Info.Lines.Add('-----显卡-------');
  Awmi.WMIType := 'Win32_VideoController';
  Memo_Info.Lines.Add('GetEnum:' + Awmi.GetEnum); //('IPEnabled=True'));
  Memo_Info.Lines.Add('Win32_VideoController name :' + vartostr(Awmi.GetProperty('name', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController Description :' + vartostr(Awmi.GetProperty('Description', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController Caption :' + vartostr(Awmi.GetProperty('Caption', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController DeviceID :' + vartostr(Awmi.GetProperty('DeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController CreationClassName :' + vartostr(Awmi.GetProperty('CreationClassName', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController PNPDeviceID :' + vartostr(Awmi.GetProperty('PNPDeviceID', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController SystemName :' + vartostr(Awmi.GetProperty('SystemName', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController VideoModeDescription :' + vartostr(Awmi.GetProperty('VideoModeDescription', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController VideoProcessor :' + vartostr(Awmi.GetProperty('VideoProcessor', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController SystemCreationClassName :' + vartostr(Awmi.GetProperty('SystemCreationClassName', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController AdapterCompatibility :' + vartostr(Awmi.GetProperty('AdapterCompatibility', devIndex)));
  Memo_Info.Lines.Add('Win32_VideoController AdapterDACType :' + vartostr(Awmi.GetProperty('AdapterDACType', devIndex)));

end;
----------------------------------------------
http://blog.sina.com.cn/bmsrnote
作者:
男 wang_80919 (Flying Wang) ★☆☆☆☆ -
普通会员
2016/12/28 16:04:44
11楼: 虽然 很多人都有类似的代码。
但是 代码的兼容性,不一定就好。
但是没有源码,那么更难确定是不是兼容。
所以,大家应该多多提供不同的代码,互相学习,提高兼容性。

所以,多谢楼上的代码。
----------------------------------------------
(C)(P)Flying Wang
作者:
男 bmsr (白忙剩人) ★☆☆☆☆ -
普通会员
2016/12/28 16:52:19
12楼: 基于WMI的信息查询和编辑,按微软的说明一般都是
Requirements
Minimum supported client  Windows Vista
Minimum supported server  Windows Server 2008
Namespace  Root\CIMV2
MOF  CIMWin32.mof
DLL  CIMWin32.dll

操作系统能读到的信息,都能读到.内容丰富的撑到爆.在windows域环境下,wmi是可以查看域内任意计算机信息的,不限于本机,当然需要你有相应域权限.
具体可msdn.microsoft.com搜索
比如磁盘的:
https://msdn.microsoft.com/en-us/library/aa394132%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
操作系统的:
https://msdn.microsoft.com/en-us/library/dn792258(v=vs.85).aspx
基本上windows整个体系方方面面统统可以用此方法读取和操作.这也是微软未来的方向,以前的单个api系统会慢慢被wmi统一掉.
当然XP对很多wmi不支持,Windows Vista 则几乎都没问题
----------------------------------------------
http://blog.sina.com.cn/bmsrnote
作者:
男 kylix2008 (kylix2008) ★☆☆☆☆ -
普通会员
2016/12/29 20:22:00
13楼: 硬盘有可能换,换CPU的极少。
读CPU序列号,公开的代码好多读不出来,或读出来的不对。
----------------------------------------------
-
作者:
男 bmsr (白忙剩人) ★☆☆☆☆ -
普通会员
2016/12/29 23:50:41
14楼: P3以后的cpu序列号都不可能读出来。
----------------------------------------------
http://blog.sina.com.cn/bmsrnote
作者:
男 ksrsoft (cb168) ★☆☆☆☆ -
普通会员
2017/2/26 9:50:23
15楼:
----------------------------------------------
-
作者:
男 zyp1984 (小李他妈的飞刀) ★☆☆☆☆ -
普通会员
2017/2/26 10:43:28
16楼: 多核的CPU编号会变.怎么搞
----------------------------------------------
山外青山楼外楼,能人背后有能人弄..
作者:
男 wr960204 (武稀松) ★☆☆☆☆ -
盒子活跃会员
2017/2/27 10:28:06
17楼: @zyp1984设置你执行CPUID指令所在线程的CPU亲缘性,让他固定工作在第1个核心。
----------------------------------------------
武稀松http://www.raysoftware.cn
作者:
男 wangarcon (大王生) ★☆☆☆☆ -
盒子活跃会员
2017/3/12 16:38:17
18楼: TrueStr
FalseStr

是什么啊
----------------------------------------------
-
作者:
女 rainy_day (下雨天) ▲▲▲△△ -
普通会员
2017/3/12 23:15:28
19楼: Delphi技术综合研讨区(QQ群:42865054)欢迎每一位热爱Delphi,坚守Delphi的朋友加入!本讨论区,旨在资源共享,技术交流,解决学习、工作中的问题。涉及的内容有:Delphi基础、控件开发、ActiveX、Com、移动开发、浏览器、图形图像处理等。
备注:
   此讨论区,注重学习交流,本群禁广告、禁推销,入群时,请注明:来自 《Delphi盒子》。
----------------------------------------------
读书无疑者,须教有疑,有疑者,却要无疑,到这里方是长进。
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行102.0508毫秒 RSS