Day 16 : 23 June 2022 : Applying Windows Registry Settings
My 100 Daze of Code
https://github.com/davidjwalling/100-days-of-code
#16 : Applying Windows Registry Settings
Today we continue to expand on our application configuration logic. We'll read the Windows registry to apply system-wide setting values. Registry values are applied first. Then, settings are tailored, first from the environment, or user, level and then from program arguments are specific to the execution of the program.
Here we've added a general routine to read a setting value from the Registry.
Next, we've added the routine that reads all defined Registry settings and applies them to our application class instance.
We'll call the new GetRegistryVars method as part of our overall configuration routine.
To test, we first add a value in our application's registry space, which was created when we installed Ava as a service. If you don't want to install Ava as a service, you can use the Registry editor to manually create the registry path.
We've created a registry entry for the log prefix.
Now, when we run Ava, we see that the logging prefix is applied from the Registry and the logging path is applied from our Environment, as we saw previously.
We can confirm the path and prefix by locating the log file created.






Comments
Post a Comment