Ícone do site Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Set of utilities for FireMonkey (iOS and macOS) to speed up your development process

Set of utilities for FireMonkey (iOS and macOS) to speed up your development process

Intro

This is the final part of the Utils library investigation. Please be sure to check out these two articles to know more about the Utils library by WINSOFT.

Specifications

Configuration

Here is an installation video tutorial of configuring for Windows OS, macOS, iOS, and Android.

Development

System Info – iOS

With the Utils library, we can fetch system information easily. For instance, hostname, OS version, physical memory, process name, and more.

To implement this process you need to include the Utils unit in your uses list and then you can call TSystemInfo class. Here how we can get the system info for iOS

procedure TFormMain.AddItem(const Text: string);
var Item: TTreeViewItem;
begin
  Item := TTreeViewItem.Create(TreeView);
  Item.Text := Text;
  TreeView.AddObject(Item);
end;

procedure TFormMain.FormCreate(Sender: TObject);
begin
  TreeView.Clear;

  with TSystemInfo.Create do
  try
    AddItem('Active processor count: ' + IntToStr(ActiveProcessorCount));
    AddItem('Host name: ' + HostName);
    AddItem('Low power mode enabled: ' + BoolToStr(LowPowerModeEnabled, True));
    AddItem('OS version: ' + IntToStr(OSVersionMajor) + '.' + IntToStr(OSVersionMinor) + '.' + IntToStr(OSVersionPatch));
    AddItem('OS: ' + OSVersion);
    AddItem('Physical memory: ' + IntToStr(PhysicalMemory div (1024 * 1024)) + ' MB');
    AddItem('Process name: ' + ProcessName);
    AddItem('Process GUID: ' + ProcessGuid);
    AddItem('Processor count: ' + IntToStr(ProcessorCount));
    AddItem('System uptime: ' + IntToStr(Trunc(SystemUptime)) + ' s');
  finally
    Free;
  end;
end;

System Info – macOS

To get system info in macOS it almost similar, but you likely to get more information about the hardware. For instance, hardware UUID, serial number, and more.

Let’s see what we can get:

procedure TFormMain.FormCreate(Sender: TObject);
begin
  with TSystemInfo.Create do
  try
    AddItem('Active processor count: ' + IntToStr(ActiveProcessorCount));
    AddItem('Full user name: ' + FullUserName);
    AddItem('Hardware UUID: ' + MachineUUID);
    AddItem('Host name: ' + HostName);
    AddItem('OS version: ' + IntToStr(OSVersionMajor) + '.' + IntToStr(OSVersionMinor) + '.' + IntToStr(OSVersionPatch));
    AddItem('OS: ' + OSVersion);
    AddItem('Physical memory: ' + IntToStr(PhysicalMemory div (1024 * 1024)) + ' MB');
    AddItem('Process name: ' + ProcessName);
    AddItem('Process GUID: ' + ProcessGuid);
    AddItem('Processor count: ' + IntToStr(ProcessorCount));
    AddItem('Serial number: ' + SerialNumber);
    AddItem('System uptime: ' + IntToStr(Trunc(SystemUptime)) + ' s');
    AddItem('User name: ' + UserName);
  finally
    Free;
  end;
end;

Thank you. Be with us and learn more about the Embarcadero Delphi and C++ Builder.

Sair da versão mobile