注册账号 登录
用友之家-用友软件论坛 返回首页

wozengcong的个人空间 https://www.oyonyou.com/?242966 [收藏] [复制] [分享] [RSS]

日志

GetSystemInfo - 获取系统信息

热度 3已有 751 次阅读2013-5-11 16:51 |个人分类:Delphi7| 信息

一、声明

代码


Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 GetSystemInfo(
  var lpSystemInfo: TSystemInfo {}
 );
 //TSystemInfo 是 _SYSTEM_INFO 结构的重定义:
 _SYSTEM_INFO = record
  case Integer of
   0: (
    dwOemId: DWORD); {返回计算机标识符, 已废弃}
   1: (
    wProcessorArchitecture: Word;    {处理器的体系结构}
    wReserved: Word;           {保留}
    dwPageSize: DWORD;          {分页大小}
    lpMinimumApplicationAddress: Pointer;{最小寻址空间}
    lpMaximumApplicationAddress: Pointer;{最大寻址空间}
    dwActiveProcessorMask: DWORD;    {处理器掩码; 0..31 表示不同的处理器}
    dwNumberOfProcessors: DWORD;     {处理器数目}
    dwProcessorType: DWORD;       {处理器类型}
    dwAllocationGranularity: DWORD;   {虚拟内存空间的粒度}
    wProcessorLevel: Word;        {处理器等级}
    wProcessorRevision: Word);      {处理器版本}
 end;

 

二、例子

例子

Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 unit Unit1;
 
 interface
 
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, StdCtrls, ComCtrls;
 
 type
   TForm1 = class(TForm)
     btn1: TButton;
     redt1: TRichEdit;
     procedure btn1Click(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
   end;
 
 var
   Form1: TForm1;
 
 implementation
 
 {$R *.dfm}
 
 procedure TForm1.btn1Click(Sender: TObject);
 var
   sys:TSystemInfo;
 begin
   GetSystemInfo(sys);
   with redt1.Lines do
   begin
     Add(Format('处理器类型 (ProcessorType):' + #9#9 +'%d',[sys.dwProcessorType]));
     Add(Format('OEMID: ' +#9#9#9#9#9 + '%d',[sys.dwOemId]));
     Add(Format('处理器架构 (ProcessorArchitecture):' + #9#9 + '%d',[sys.wProcessorArchitecture]));
     Add(Format('处理器数量 (NumberOfProcessors):'+ #9#9 + '%d',[sys.dwNumberOfProcessors]));
     Add(Format('处理器版本 (ProcessorRevision):' + #9#9 + '%d',[sys.wProcessorRevision]));
     Add(Format('分页大小 (PageSize):' + #9#9#9 + '%d',[Sys.dwPageSize]));
     Add(Format('最小寻址空间 (MinimumApplicationAddress):' +#9 + '%d',[Integer(Sys.lpMinimumApplicationAddress)]));
     Add(Format('最大寻址空间 (MaximumApplicationAddress):' +#9 + '%d',[Integer(Sys.lpMaximumApplicationAddress)]));
     Add(Format('处理器掩码 (ActiveProcessorMask):' +#9#9 + '%d',[Integer(Sys.dwActiveProcessorMask)]));
     Add(Format('处理器内存粒度 (AllocationGranularity):' +#9 + '%d',[Integer(Sys.dwAllocationGranularity)]));
     Add(Format('处理器等级 (ProcessorLevel):' +#9#9 + '%d',[Integer(Sys.wProcessorLevel)]));
 
   end;
 
 
 end;
 
 end.

1

路过

雷人
1

握手

鲜花

鸡蛋

刚表态过的朋友 (2 人)

发表评论 评论 (1 个评论)

回复 tangz1987 2013-5-24 11:18
  

facelist

您需要登录后才可以评论 登录 | 注册账号

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-5-16 18:47 , Processed in 0.021251 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部