DelphiDabbler Code Snippets Database

Snippet Selection

The following snippets from the Code Snippets Database have been requested.

GetBiosVendor

Returns the name of the computer's BIOS vendor.

function GetBiosVendor: string;
var
  Reg: Registry.TRegistry;
begin
  Result := '';
  Reg := Registry.TRegistry.Create(Windows.KEY_READ);
  try
    Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
    if not Reg.OpenKey('HARDWARE\DESCRIPTION\System\Bios\', False) then
      Exit;
    Result := Reg.ReadString('BIOSVendor');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

GetProcessorIdentifier

Returns the identifier of the computer's processor.

function GetProcessorIdentifier: string;
var
  Reg: Registry.TRegistry;
begin
  Result := '';
  Reg := Registry.TRegistry.Create(Windows.KEY_READ);
  try
    Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
    if not Reg.OpenKey(
      'HARDWARE\DESCRIPTION\System\CentralProcessor\0\', False
    ) then
      Exit;
    Result := Reg.ReadString('Identifier');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

GetProcessorName

Return the name of the computer's processor.

function GetProcessorName: string;
var
  Reg: Registry.TRegistry;
begin
  Result := '';
  Reg := Registry.TRegistry.Create(Windows.KEY_READ);
  try
    Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
    if not Reg.OpenKey(
      'HARDWARE\DESCRIPTION\System\CentralProcessor\0\', False
    ) then
      Exit;
    Result := Reg.ReadString('ProcessorNameString');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

GetSystemManufacturer

Returns the name of the computer's manufacturer.

function GetSystemManufacturer: string;
var
  Reg: Registry.TRegistry;
begin
  Result := '';
  Reg := Registry.TRegistry.Create(Windows.KEY_READ);
  try
    Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
    if not Reg.OpenKey('HARDWARE\DESCRIPTION\System\Bios\', False) then
      Exit;
    Result := Reg.ReadString('SystemManufacturer');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

GetSystemProductName

Returns the system product name.

function GetSystemProductName: string;
var
  Reg: Registry.TRegistry;
begin
  Result := '';
  Reg := Registry.TRegistry.Create(Windows.KEY_READ);
  try
    Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
    if not Reg.OpenKey('HARDWARE\DESCRIPTION\System\Bios\', False) then
      Exit;
    Result := Reg.ReadString('SystemProductName');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

View the whole database.

Go to the DelphiDabbler website.