delphi中获取系统信息
1.获取系统目录
procedure TForm1.btn1Click(Sender: TObject); var adr:array[0..MAX_PATH] of Char; begin GetSystemDirectory(adr,MAX_PATH); ShowMessage(adr); end;
2.获取windows目录
procedure TForm1.btn1Click(Sender: TObject); var adr:array[0..MAX_PATH] of Char; begin GetWindowsDirectory(adr,MAX_PATH); ShowMessage(adr); end;
3.系统信息
procedure TForm1.btn1Click(Sender: TObject); var adr:array[0..MAX_PATH] of Char; info:_SYSTEM_INFO; begin mmo1.Clear; GetSystemInfo(info); with mmo1.Lines do begin Add(Format('处理器的类型:%d',[info.dwProcessorType])); Add(Format('OEMID是:%d',[info.dwOemId])); Add(Format('处理器架构:%d',[info.wProcessorArchitecture])); Add(Format('处理器数量:%d',[info.dwNumberOfProcessors])); Add(Format('处理器版本:%d',[info.wProcessorRevision])); Add(Format('分页大小:%d',[info.dwPageSize])); Add(Format('最小寻址空间:%d',[Integer(info.lpMinimumApplicationAddress)])); Add(Format('最大寻址空间:%d',[Integer(info.lpMaximumApplicationAddress)])); Add(Format('处理器掩码:%d',[Integer(info.dwActiveProcessorMask)])); Add(Format('处理器粒度:%d',[Integer(info.dwAllocationGranularity)])); Add(Format('处理器等级:%d',[Integer(info.wProcessorLevel)])); end; end;