It's not hard:
LocalMachine := TRegistry.Create(KEY_READ);
LocalMachine.RootKey := HKey_Local_Machine;
LocalMachine.OpenKey('Software\..\..\..',True);
LocalMachine.WriteString('myvalue');
LocalMachine.CloseKey();
LocalMachine.OpenKey('',False);
--
"Paul Tugwell" <pa...@guardbase.co.uk> wrote
Sure - immediately after creating the TRegistryIniFile instance, set
RegIniFile.RootKey, then reset the base path (as setting RootKey clears
it):
Settings := TRegistryIniFile.Create(MyRegPath);
try
Settings.RegIniFile.RootKey := HKEY_LOCAL_MACHINE;
Settings.RegIniFile.OpenKey(Settings.FileName, True);
//do stuff
finally
Settings.Free;
end;
Note you app will need to have administrator rights - Vista will
silently convert your WriteXXX calls to a 'VirtualStore' key somewhere
under HKEY_CURRENT_USER otherwise.