Código: Seleccionar todo
uses
Windows;
var
Size: Cardinal;
hKey: Windows.HKEY;
Buffer: ShortString;
Str: string;
procedure CambiarID(NvoNombre : string);
function LeerID():string;
implementation
function LeerId(): string;
begin
RegOpenKey(HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion', hKey);
Size := SizeOf(Buffer);
RegQueryValueEx(hKey, 'Nombre', nil, nil, @Buffer, @Size);
Str := Str + string(PChar(@Buffer));
RegCloseKey(hKey);
Result := (Str);
if Result = '' then
Result := 'Jesus';
end;