Mega Code Archive

 
Categories / Delphi / System
 

How to get the Windows NT2000 domain name

Title: How to get the Windows NT/2000 domain name Question: Where to find the domainname in the registry... Answer: A small function that looks at the right place in the registry: function GetNTDomainName: string; var hReg: TRegistry; begin hReg := TRegistry.Create; hReg.RootKey := HKEY_LOCAL_MACHINE; hReg.OpenKey('SOFTWARE\Microsoft\Windows NT\CurrentVersion \Winlogon', false ); Result := hReg.ReadString( 'DefaultDomainName' ); hReg.CloseKey; hReg.Destroy; end;