Téléchargé 2 fois
Vote des utilisateurs
0
0
Détails
Licence : Non renseignée
Mise en ligne le 31 octobre 2025
Plate-forme :
Windows
Langue : Français
Référencé dans
Navigation
TSystemInfo - Une Class pour la collecte d’informations système Windows
TSystemInfo - Une Class pour la collecte d’informations système Windows
TSystemInfo est une classe qui centralise la collecte d’informations système Windows (Windows 10/11) en combinant WMI et API Windows.
Principales méthodes exposées :
- GetOSInfo : nom, version, build, architecture, date d’installation.
- GetCPUInfo : nom, fabricant, identifiant, nombre de cœurs/threads, fréquence max.
- GetMemoryInfo : mémoire totale/disponible, pourcentage d’utilisation, mémoire virtuelle.
- GetDiskInfo : lecteurs logiques (taille et espace libre formatés).
- GetNetworkAdapters : adaptateurs IP activés, adresses MAC/IP, passerelle, DNS.
- GetGPUInfo : contrôleurs vidéo, RAM adaptateur formatée.
- GetBIOSInfo / GetBaseBoardInfo / GetBatteryInfo — informations matérielles.
- GetUsers : comptes locaux.
- GetHotFixes : correctifs installés.
- GetPrinters / GetServices / GetProcesses : imprimantes, services (état, mode démarrage), processus en cours.
- GetTimeZoneAndLocale : fuseau horaire et locale utilisateur.
- GetPowerPlan : GUID du plan d’alimentation actif.
- GetHostAndUptime : nom d’hôte et durée de fonctionnement (WMI ou fallback).
Exemple d’utilisation de TSystemInfo (console) :
[code]uses
System.SysUtils,
System.Classes,
System.Math,
SystemInfo in 'SystemInfo.pas';
procedure GetInfoSystem(const Titre: string; SL: TStringList);
var
i: Integer;
begin
Writeln('--- ' + Titre + ' ---');
if (SL = nil) or (SL.Count = 0) then
begin
Writeln('(aucune donnée)');
Exit;
end;
for i := 0 to SL.Count - 1 do
Writeln(SL[i]);
Writeln;
end;
var
SI: TSystemInfo;
SL: TStringList;
begin
try
SI := TSystemInfo.Create;
try
// Informations OS
SL := SI.GetOSInfo;
try
GetInfoSystem('Informations OS', SL);
finally
SL.Free;
end;
// Processeur
SL := SI.GetCPUInfo;
try
GetInfoSystem('Processeur', SL);
finally
SL.Free;
end;
// Mémoire
SL := SI.GetMemoryInfo;
try
GetInfoSystem('Mémoire', SL);
finally
SL.Free;
end;
// Disques
SL := SI.GetDiskInfo;
try
GetInfoSystem('Disques', SL);
finally
SL.Free;
end;
// Réseau
SL := SI.GetNetworkAdapters;
try
GetInfoSystem('Adaptateurs réseau', SL);
finally
SL.Free;
end;
// GPU
SL := SI.GetGPUInfo;
try
GetInfoSystem('Carte graphique', SL);
finally
SL.Free;
end;
// Services (extrait pour lisibilité)
SL := SI.GetServices;
try
Writeln('--- Services (extrait) ---');
if SL.Count = 0 then
Writeln('(aucun service)')
else
for var i := 0 to Min(29, SL.Count - 1) do
Writeln(SL[i]);
Writeln;
finally
SL.Free;
end;
// Processus
SL := SI.GetProcesses;
try
GetInfoSystem('Processus en cours', SL);
finally
SL.Free;
end;
// Hôte et uptime
SL := SI.GetHostAndUptime;
try
GetInfoSystem('Hôte et durée de fonctionnement', SL);
finally
SL.Free;
end;
finally
SI.Free;
end;
except
on E: Exception do
Writeln('Exception: ', E.ClassName, ' - ', E.Message);
end;
Writeln('Appuyez sur Entrée pour quitter...');
Readln;
end.[code/]
Compatible avec Delphi 2009 et versions ultérieures (Delphi XE2 … Delphi 10.x / 11.x / ...)
Principales méthodes exposées :
- GetOSInfo : nom, version, build, architecture, date d’installation.
- GetCPUInfo : nom, fabricant, identifiant, nombre de cœurs/threads, fréquence max.
- GetMemoryInfo : mémoire totale/disponible, pourcentage d’utilisation, mémoire virtuelle.
- GetDiskInfo : lecteurs logiques (taille et espace libre formatés).
- GetNetworkAdapters : adaptateurs IP activés, adresses MAC/IP, passerelle, DNS.
- GetGPUInfo : contrôleurs vidéo, RAM adaptateur formatée.
- GetBIOSInfo / GetBaseBoardInfo / GetBatteryInfo — informations matérielles.
- GetUsers : comptes locaux.
- GetHotFixes : correctifs installés.
- GetPrinters / GetServices / GetProcesses : imprimantes, services (état, mode démarrage), processus en cours.
- GetTimeZoneAndLocale : fuseau horaire et locale utilisateur.
- GetPowerPlan : GUID du plan d’alimentation actif.
- GetHostAndUptime : nom d’hôte et durée de fonctionnement (WMI ou fallback).
Exemple d’utilisation de TSystemInfo (console) :
[code]uses
System.SysUtils,
System.Classes,
System.Math,
SystemInfo in 'SystemInfo.pas';
procedure GetInfoSystem(const Titre: string; SL: TStringList);
var
i: Integer;
begin
Writeln('--- ' + Titre + ' ---');
if (SL = nil) or (SL.Count = 0) then
begin
Writeln('(aucune donnée)');
Exit;
end;
for i := 0 to SL.Count - 1 do
Writeln(SL[i]);
Writeln;
end;
var
SI: TSystemInfo;
SL: TStringList;
begin
try
SI := TSystemInfo.Create;
try
// Informations OS
SL := SI.GetOSInfo;
try
GetInfoSystem('Informations OS', SL);
finally
SL.Free;
end;
// Processeur
SL := SI.GetCPUInfo;
try
GetInfoSystem('Processeur', SL);
finally
SL.Free;
end;
// Mémoire
SL := SI.GetMemoryInfo;
try
GetInfoSystem('Mémoire', SL);
finally
SL.Free;
end;
// Disques
SL := SI.GetDiskInfo;
try
GetInfoSystem('Disques', SL);
finally
SL.Free;
end;
// Réseau
SL := SI.GetNetworkAdapters;
try
GetInfoSystem('Adaptateurs réseau', SL);
finally
SL.Free;
end;
// GPU
SL := SI.GetGPUInfo;
try
GetInfoSystem('Carte graphique', SL);
finally
SL.Free;
end;
// Services (extrait pour lisibilité)
SL := SI.GetServices;
try
Writeln('--- Services (extrait) ---');
if SL.Count = 0 then
Writeln('(aucun service)')
else
for var i := 0 to Min(29, SL.Count - 1) do
Writeln(SL[i]);
Writeln;
finally
SL.Free;
end;
// Processus
SL := SI.GetProcesses;
try
GetInfoSystem('Processus en cours', SL);
finally
SL.Free;
end;
// Hôte et uptime
SL := SI.GetHostAndUptime;
try
GetInfoSystem('Hôte et durée de fonctionnement', SL);
finally
SL.Free;
end;
finally
SI.Free;
end;
except
on E: Exception do
Writeln('Exception: ', E.ClassName, ' - ', E.Message);
end;
Writeln('Appuyez sur Entrée pour quitter...');
Readln;
end.[code/]
Compatible avec Delphi 2009 et versions ultérieures (Delphi XE2 … Delphi 10.x / 11.x / ...)
Developpez.com décline toute responsabilité quant à l'utilisation des différents éléments téléchargés.