



Com esta função podemos facilmente ler informações
no registro do Windows, simplesmente passando a
chave e a função retorna valor como String.
É necessário estar declarado Registry na seção uses,
em versões unicode declare System.Win.Registry.
Abaixo segue o código fonte da função:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function ReadRegistyDll(Chave : String) : String; var Registro : TRegistry; begin Registro := TRegistry.Create; Registro.RootKey := HKEY_CURRENT_USER; Result := ''; if (Registro.OpenKey(Chave, True)) then begin Result := Registro.ReadString(Chave); end; Registro.CloseKey; Registro.Free; end; |
Exemplo de uso
1 2 3 4 | procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(ReadRegistyDll('showdelphi')); end; |
Segue abaixo o link de como efetuar a escrita de valores no registro do Windows.
http://showdelphi.com.br/dica-como-escrever-valores-no-registro-do-windows-delphi/