whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

28 Visitors Online


 
...retrieve the licensing information from Windows?
Autor: Rainer Kümmerle
Homepage: http://www.thinklazy.de
[ Print tip ]  


Tip Rating (1):  
     


uses
  
Registry;


procedure GetOwnerAndCompanyName(var sOwner, sOrganization: string);
var
  
reg: TRegistry;
  vi: TOSVersionInfo;
  sWindows: string;
begin
  
reg      := TRegistry.Create;
  sWindows := '\Windows\';
  try
    
vi.dwOSVersionInfoSize := SizeOf(vi);
    getversionex(vi);
    reg.RootKey := HKEY_LOCAL_MACHINE;
    if (vi.dwPlatformId = VER_PLATFORM_WIN32_NT) then sWindows := '\Windows NT\';
    if reg.OpenKey('Software\Microsoft' + sWindows + 'CurrentVersion', False) then
    begin
      
// Name
      
sOwner := reg.ReadString('RegisteredOwner');
      // Organization
      
sOrganization := reg.ReadString('RegisteredOrganization');
    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;


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners