zoukankan      html  css  js  c++  java
  • WinAPI: GetSystemInfo 获取系统信息

    //声明:
    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;
    
    //举例:
    procedure TForm1.FormCreate(Sender: TObject);
    var
      SI: TSystemInfo;
    begin
      GetSystemInfo(SI);
      Memo1.Clear;
      with Memo1.Lines do
      begin
        Add(Format('OEMID:' + #9#9 + '%d', [SI.dwOemId]));
        Add(Format('处理器体系结构:' + #9 + '%d', [SI.wProcessorArchitecture]));
        Add(Format('分页大小:' + #9 + '%d', [SI.dwPageSize]));
        Add(Format('最小寻址空间:' + #9 + '%d', [Integer(SI.lpMinimumApplicationAddress)]));
        Add(Format('最大寻址空间:' + #9 + '%d', [Integer(SI.lpMaximumApplicationAddress)]));
        Add(Format('处理器掩码:' + #9 + '%d', [SI.dwActiveProcessorMask]));
        Add(Format('处理器数目:' + #9 + '%d', [SI.dwNumberOfProcessors]));
        Add(Format('处理器类型:' + #9 + '%d', [SI.dwProcessorType]));
        Add(Format('虚拟内存粒度:' + #9 + '%d', [SI.dwAllocationGranularity]));
        Add(Format('处理器等级:' + #9 + '%d', [SI.wProcessorLevel]));
        Add(Format('处理器版本:' + #9 + '%d', [SI.wProcessorRevision]));
      end;
    end;
    
    //效果图:

  • 相关阅读:
    C# 打开模态对话框 和打开文件夹
    C# 统计字符串出现的个数
    html table内容不随标题滚动
    log4net 局部代码 看不懂....
    js的replace, 高亮, insertAdjacentHTML , tbody.innerHTML
    python之tkinter使用举例-Button
    使用pygal_maps_world.i18n中数据画各大洲地图
    使用pygal_maps_world展示世界地图
    python之pygal:掷两个不同的骰子并统计大小出现次数
    python之文件目录操作
  • 原文地址:https://www.cnblogs.com/del/p/1066834.html
Copyright © 2011-2022 走看看