Ver Mensaje Individual
  #2  
Antiguo 01-03-2004
__cadetill __cadetill is offline
Miembro
 
Registrado: may 2003
Posts: 3.387
Reputación: 25
__cadetill Va por buen camino
En el help de Delphi viene este ejemplo

Código:
procedure TForm1.Button1Click(Sender: TObject);
var
  Reg: TRegIniFile;
begin
  if Length(NameofKey.Text) or Length(ValueforKey.Text) <=0 then
    Showmessage('Either the key name or value is missing.')
  else begin
    Reg:=TRegIniFile.Create('MyApp');
    try
      Reg.RootKey:=HKey_Local_Machine; // Section to look for within the registry
      if not Reg.OpenKey(NameofKey.Text,False) then
        if MessageDlg('The specified key does not exist, create it?'

                 ,Mtinformation,[mbYes,mbNo],0)=mryes then
        begin
          Reg.CreateKey(NameofKey.Text);
          if not Reg.OpenKey(NameofKey.Text,False) then
            ShowMessage('Error in Opening Created Key')
          else
            Reg.WriteString('Main Section','Value1',ValueForKey.Text);
        end
     else
       Reg.WriteString('Main Section','Value1',ValueForKey.Text);
    finally

      Reg.Free;
    end;
  end;
end;
Recuerda que has de tener derechos de administrador para acceder al registro (almenos para modificarlo)
Responder Con Cita