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
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
精彩评论