Link to home
Start Free TrialLog in
Avatar of urivera
urivera

asked on

Using CRegKey

Hello,

I was wondering if someone can provide me with an example on how to write/read from the registry using the CRegKey class.  I have never worked with the registry so please provide as much detail as possible. I basically need is to save a bunch of values from different dialog boxes, in other words to save a configuration.  I want to have an entry in registry with my company name, and under there and entry for the software program and then the configurations.  So I was to view it using regedit it would look something like this:

myComanyName
      softwareName
            Configurations
                 ConfigurationName1   (name of configuration as saved by the user)
                      checkbox1 = TRUE or FALSE (some data stored so when I read it I can tell if it was selected or not)
                      checkbox2 = TRUE or FALSE (TRUE means it was checked)
                      checkbox3 = TRUE or FALSE
                      .......   (I will be storing about 40+ different data for each configuration)
                 ConfigurationName2
                      checkbox1 = TRUE or FALSE
                      checkbox2= TRUE or FALSE
                      checkbox3 = TRUE or FALSE

                             
I want to call the functions (method) to save to the registry when the user clicks on "Save" button from within my own child dialog box I created, is that best place to write to the registry?

User will be able to click on a "Load Configuration" button from the main window or from the File menu, which will cause a child dialog box to appear(I already build the dialog box), I want to display all the current configurations saved in the registry, so I need to iterate through each one, get the configuration name and add it to my list.  After that the user will select a configuration, I then need to query each checkbox value to set my checkbox controls accordingly.  Is there an easy way to do this using CRegKey? and if so, example(s)?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of srini_vc
srini_vc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of urivera
urivera

ASKER

I also forgot to mention that I will need to delete a configuration from the registry.  Any other examples?
Same thing man.
u have to just call the deleteKey() function of CRegKey.

get the help from msdn. The basic things r discussed there. if u got any doubt in using them ask here.

but u have to be aware of things, before deleting. adding ref key may not cause error. If we deleted some system variable, then it cause even windows can't start.

be safe before use it.

try to delete ur own created keys only.

u can also call RegDeleteKey to delete the entire key.
and u can call RegDeleteValue to delete the value stored in particular key.

if u r still finding hard to implemet , we will help u soon.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of urivera

ASKER

Any other solutions?
What Else Solution your need Ms Univera, could you please state your need here!!!

Thanks
Hope So No Answer!!!!