Topic: [SOLVED] Write to the Registry
Hi,
I have this procedure where I'm trying to write a KEY to the Registry and it's not working. This one uses a button OnClick event, but I've tried other Events with no luck
-
procedure frmNagScreen_btnSave_OnClick (Sender: TObject; var Cancel: boolean);
var
reg: TRegistry;
sKey : string;
begin
sKey := frmNagScreen.skey.Text;
// THIS IS FOR TESTING showMessage('Nag Screen sKey = '+sKey);
reg.Access := KEY_ALL_ACCESS;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('software\RecordsX.exe',true);
if not reg.ValueExists('Key') then reg.WriteString('Key', sKey);
end;
-
Any thoughts will be appreciated
Thanks, Frank
-
[SOLVED] I had to add this line of code above reg.Access
reg := TRegistry.Create;
-
Note: I would like to thank these folks who have helped me to add a 30-Day Trial Option
to my program. Brian, Jean, Domebil, CDB, EHW, Sibprogistem
It was one of my toughest programming problems so far. Thanks again for your help.
-
Frank