在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
一、声明
代码
1 GetSystemInfo(
2 var lpSystemInfo: TSystemInfo {} 3 ); 4 //TSystemInfo 是 _SYSTEM_INFO 结构的重定义: 5 _SYSTEM_INFO = record 6 case Integer of 7 0: ( 8 dwOemId: DWORD); {返回计算机标识符, 已废弃} 9 1: ( 10 wProcessorArchitecture: Word; {处理器的体系结构} 11 wReserved: Word; {保留} 12 dwPageSize: DWORD; {分页大小} 13 lpMinimumApplicationAddress: Pointer;{最小寻址空间} 14 lpMaximumApplicationAddress: Pointer;{最大寻址空间} 15 dwActiveProcessorMask: DWORD; {处理器掩码; 0..31 表示不同的处理器} 16 dwNumberOfProcessors: DWORD; {处理器数目} 17 dwProcessorType: DWORD; {处理器类型} 18 dwAllocationGranularity: DWORD; {虚拟内存空间的粒度} 19 wProcessorLevel: Word; {处理器等级} 20 wProcessorRevision: Word); {处理器版本} 21 end; 22
二、例子
例子
1 unit Unit1;
2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls, ComCtrls; 8 9 type 10 TForm1 = class(TForm) 11 btn1: TButton; 12 redt1: TRichEdit; 13 procedure btn1Click(Sender: TObject); 14 private 15 { Private declarations } 16 public 17 { Public declarations } 18 end; 19 20 var 21 Form1: TForm1; 22 23 implementation 24 25 {$R *.dfm} 26 27 procedure TForm1.btn1Click(Sender: TObject); 28 var 29 sys:TSystemInfo; 30 begin 31 GetSystemInfo(sys); 32 with redt1.Lines do 33 begin 34 Add(Format('处理器类型 (ProcessorType):' + #9#9 +'%d',[sys.dwProcessorType])); 35 Add(Format('OEMID: ' +#9#9#9#9#9 + '%d',[sys.dwOemId])); 36 Add(Format('处理器架构 (ProcessorArchitecture):' + #9#9 + '%d',[sys.wProcessorArchitecture])); 37 Add(Format('处理器数量 (NumberOfProcessors):'+ #9#9 + '%d',[sys.dwNumberOfProcessors])); 38 Add(Format('处理器版本 (ProcessorRevision):' + #9#9 + '%d',[sys.wProcessorRevision])); 39 Add(Format('分页大小 (PageSize):' + #9#9#9 + '%d',[Sys.dwPageSize])); 40 Add(Format('最小寻址空间 (MinimumApplicationAddress):' +#9 + '%d',[Integer(Sys.lpMinimumApplicationAddress)])); 41 Add(Format('最大寻址空间 (MaximumApplicationAddress):' +#9 + '%d',[Integer(Sys.lpMaximumApplicationAddress)])); 42 Add(Format('处理器掩码 (ActiveProcessorMask):' +#9#9 + '%d',[Integer(Sys.dwActiveProcessorMask)])); 43 Add(Format('处理器内存粒度 (AllocationGranularity):' +#9 + '%d',[Integer(Sys.dwAllocationGranularity)])); 44 Add(Format('处理器等级 (ProcessorLevel):' +#9#9 + '%d',[Integer(Sys.wProcessorLevel)])); 45 46 end; 47 48 49 end; 50 51 end. 52
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论