Retrouver les informations de licence Windows

uses
Registry;

{...}

procedure GetOwnerAndCompanyName( var sOwner, sOrganization : string);
var
reg: TRegistry;
begin
reg:= TRegistry.Create;
try
reg.RootKey:= HKEY_LOCAL_MACHINE;
if reg.OpenKey('SoftwareMicrosoftWindowsCurrentVersion', false) then
begin
// Name
sOwner := reg.ReadString('RegisteredOwner');
// Organization
sOrganization := reg.ReadString('RegisteredOrganization');
end;
if sOwner = '' then
begin
reg.CloseKey;
reg.RootKey := HKEY_LOCAL_MACHINE;
if reg.OpenKey('SoftwareMicrosoftWindows NTCurrentVersion', false) then
begin
// Name
sOwner := reg.ReadString('RegisteredOwner');
// Organization
sOrganization := reg.ReadString('RegisteredOrganization');
end;
end;
finally
reg.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
sOwner, sOrganization : string;
begin
GetOwnerAndCompanyName(sOwner,sOrganization);
Edit1.Text:= sOwner;
Edit2.Text:= sOrganization;
end;
Ajouter un commentaire
Pseudo
Adresse email
Site internet (optionnel)
Votre commentaire
Fiche de l'article
Mise a jour28/11/2001
VisualisationVu 751 fois
PublicInternaute zz
CategorieDelphi - Trucs et astuces - Systeme
Auteur de l'article
SwissDelphiCenter SwissDelphiCenter
connecté le 02/11/2011
329 articles dans la section
Contacter l'auteur