Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code to save setting in registry

I have a pop-up menu..every time the users log into the system, the pop-up menu will appear but for the users that don't want this pop-up to appear on their screen, i use checkbox so that the pop-up not appear every time they login. how i want to save the setting in registry for the users that checked the check box so that the pop-up menu not appear

like image 623
zizil Avatar asked Mar 10 '26 00:03

zizil


1 Answers

You can use TRegistry class to Read/Save values from/to registry.
See on Help; There are some samples of use.

For read some like This:

 RegNGFS:= TRegistry.Create;
   try
     RegNGFS.RootKey := HKEY_CURRENT_USER;
     if RegNGFS.OpenKey('SOFTWARE\NGFS', FALSE) then begin
       MaxSteps:= RegNGFS.ReadInteger('MaxSteps');
       StopIN:= RegNGFS.ReadInteger('StopIN');
     end;
   finally
     RegNGFS.Free;
   end;

For write, some like this:

   RegNGFS:= TRegistry.Create;
   try
     RegNGFS.RootKey := HKEY_CURRENT_USER;
     if RegNGFS.OpenKey('SOFTWARE\NGFS', TRUE) then begin
       RegNGFS.ReadInteger('MaxSteps', MaxSteps);
       RegNGFS.ReadInteger('StopIN', StopIN);
     end;
   finally
     RegNGFS.Free;
   end;

You an test some methods like WriteBool, ReadBool, ReadString, WriteString,...
Regards

like image 156
Germán Estévez -Neftalí- Avatar answered Mar 12 '26 20:03

Germán Estévez -Neftalí-