Como escrever valores no registro do Windows?
Com esta função podemos facilmente gravar informações
no registro do Windows, simplesmente passando a
chave e o valor.
É 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
| function WriteRegistyDll(Chave, Valor : String) : String;
var
Registro : TRegistry;
begin
Registro := TRegistry.Create;
Registro.RootKey := HKEY_CURRENT_USER;
if (Registro.OpenKey(Chave, True)) then
begin
Registro.WriteString(Chave, Valor);
end;
Registro.CloseKey;
Registro.Free;
end; |
function WriteRegistyDll(Chave, Valor : String) : String;
var
Registro : TRegistry;
begin
Registro := TRegistry.Create;
Registro.RootKey := HKEY_CURRENT_USER;
if (Registro.OpenKey(Chave, True)) then
begin
Registro.WriteString(Chave, Valor);
end;
Registro.CloseKey;
Registro.Free;
end;
Exemplo de uso
1
2
3
4
| procedure TForm1.Button1Click(Sender: TObject);
begin
WriteRegistyDll('showdelphi', 'www.showdelphi.com.br');
end; |
procedure TForm1.Button1Click(Sender: TObject);
begin
WriteRegistyDll('showdelphi', 'www.showdelphi.com.br');
end;
Segue abaixo o link de como efetuar a leitura de valores no registro do Windows.
http://showdelphi.com.br/dica-como-ler-valores-do-registro-do-windows-delphi/
-
InfusTec
-
2.842 views
- 0 comentários
- 26 de março de 2015
Está gostando do conteúdo? Considere pagar um cafezinho para nossa equipe!
Posts Relacionados - Continue Aprendendo