[TRegistry] Problème de RootKey
Bonjour,
J'utilise le code suivant dans mon application:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
with Reg do
begin
TRegistry.Create;
OpenKey('Software', True);
OpenKey('JP''s', True);
OpenKey('To100', True);
if KeyExists('ColorNumbers') then
begin
ColorNumbers := Reg.ReadInteger('ColorNumbers');
ColorEmptyBox := Reg.ReadInteger('ColorEmptyBox');
ColorSelectedBox := Reg.ReadInteger('ColorSelectedBox');
ColorPossibleBox := Reg.ReadInteger('ColorPossibleBox');
ColorLatestBox := Reg.ReadInteger('ColorLatestBox');
CloseKey;
Destroy;
end
else
begin
ColorNumbers := clBlack;
ColorEmptyBox := clWhite;
ColorSelectedBox := clSilver;
ColorPossibleBox := clNavy;
ColorLatestBox := clGray;
WriteInteger('ColorNumbers', ColorNumbers);
WriteInteger('ColorEmptyBox', ColorEmptyBox);
WriteInteger('ColorSelectedBox', ColorSelectedBox);
WriteInteger('ColorPossibleBox', ColorPossibleBox);
WriteInteger('ColorLatestBox', ColorLatestBox);
CloseKey;
Destroy;
end;
end; |
Puis, celui-ci (qui est identique dans la forme):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
with Reg do
begin
TRegistry.Create;
OpenKey('Software', True);
OpenKey('JP''s', True);
OpenKey('To100', True);
WriteInteger('ColorNumbers', ColorNumbers);
WriteInteger('ColorEmptyBox', ColorEmptyBox);
WriteInteger('ColorSelectedBox', ColorSelectedBox);
WriteInteger('ColorPossibleBox', ColorPossibleBox);
WriteInteger('ColorLatestBox', ColorPossibleBox);
CloseKey;
Destroy;
end; |
Ma variable Reg est privée à la fonction dans laquelle elle est applelée.
Mon problème est que l'une des fonction va pointer sur HKEY_USERS\S-1-5-21-507921405-764733703-839522115-1153\Software\JP's\To100 et l'autre sur HKEY_CURRENT_USER\Software\JP's\To100.
Le problème est donc que j'écris mes valeurs dans une clé et je les lis dans une autre qui a été écrite auparavant!!! (c'est pas très clair tout ça)
Est-ce que l'un de vous aurait une idée pour que je puisse tout le temps pointer vers la même RootKey?
Merci d'avance.
Jérôme