Autor Beitrag
FSS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: So 18.06.06 18:35 
Hallo,

ich speichere eine Einstellung in der Registry ab. Das Programm soll Sie nun auslesen. Das mache ich mit folgendem Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
uses Registry;


var
regist: Tregistry;
color: String;
begin
  regist := TRegistry.Create;
  regist.RootKey := HKEY_CURRENT_USER;
  try
    regist.OpenKey('Software\Firma\Produkt\1.0', true);
    color := regist.ReadString('current_color');
    regist.free;
  except
  ShowMessage('Fehler');
  end;
  end;


D.h. das Programm soll den Wert auslesen und in der Variablen color speichern, und wenn das nicht geht eine Meldung bringen.

Das funktioniert aber irgendwie nicht. Der Wert current_color existiert in der registry noch nicht, das Programm bringt aber keine Fehlermeldung und die Variable bleibt leer.

Weiß jemand wo da der Fehler ligt?

FSS
Bernhard Geyer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 721
Erhaltene Danke: 3



BeitragVerfasst: So 18.06.06 20:00 
Schon mal die Delphi-Hilfe zu OpenKey zu rate gezogen?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 18.06.06 20:04 
Wie Berhard schon gesagt hat, konsultiere die hilfe, im besonderen den 2. Parameter von .OpenKey.

_________________
Markus Kinzler.
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: So 18.06.06 20:17 
Der zweite Parameter gibt an, ob der Sclüssel erzeugt werdden soll.

Wenn ich hier false angebe, passiert trotzdem das gleiche, also garnichts.