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.
- Utils library for VCL
- Utils library for FireMonkey (Android)
Specifications
- Supported OSs: Win32-64, Android32-64, macOS 64 & iOS 64
- Available for Delphi & C++ Builder 6-10.4
Configuration
Here is an installation video tutorial of configuring for Windows OS, macOS, iOS, and Android.
- Installation Video
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.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition