码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi 读取CPU Id

时间:2015-07-02 19:22:40      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

在网上找了很久,终于找了一段能读出正确CPU ID 的代码,以下代码经过Delphi7测试

procedure TForm1.Button1Click(Sender: TObject);
var
   _eax, _ebx, _ecx, _edx: Longword;
   s, s1, s2,result: string;
begin
  asm
     push eax
     push ebx
     push ecx
     push edx
     mov eax,1
     db $0F,$A2
     mov _eax,eax
     mov _ebx,ebx
     mov _ecx,ecx
     mov _edx,edx
     pop edx
     pop ecx
     pop ebx
     pop eax
  end;
   s := IntToHex(_eax, 8);
   s1 := IntToHex(_edx, 8);
   s2 := IntToHex(_ecx, 8);
   result:=s+s1+s2;
   edit1.Text:=result;
end;

 

Delphi 读取CPU Id

标签:

原文地址:http://www.cnblogs.com/tc310/p/4616799.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!