ok, registry editing has to be done through Windows API. There are several functions and unfortunately unlike C++ you cant just overload so they will all have the same name. So basically we will have several functions, one for writing strings, one for writing DWords (long integers), one for writing Binary (Bytes). In addition for each of these you need one to save the value and one to get the value. Then you need one for creating a key and deleteing a key and one for deleting a value (the values are automatically created if they dont exist when you try to write to them). All of this is very complicated and at your point would probably futile to try and explain completely but thats the beauty of functions, subs and modules, so... add the following module to your program and use this to call the functions/subs
Hkey Constants
HKLM = HKEY_LOCAL_MACHINE
HKCU = HKEY_CURRENT_USER
HKU = HKEY_USERS
HKCC = HKEY_CURRENT_CONFIG
HKCR = HKEY_CLASSES_ROOT
In most cases you will want to use only HKLM unless your program is to only affect the user that is logged on currently in which case you would use HKCU. Below you will substitute [HKEY] with one of the above.
For the following, [PATH] refers to the location of the key or value. In the case of creating a key or deleting a key it will also include the name of the key you wish to create or delete.
Example: "Software\VirtuaWallpaper\Settings"
With this example, you would either be creating or deleting the Settings key OR you would be placing a value in the settings key. The VirtuaWallpaper key would remain intact if you deleted it, If you were creating a key the VirtuaWallpaper key would be created if it didnt already exisit (I think) It would be best to create the keys in seperate lines cause I'm not sure if that would work or not.
[VALUE] is the name of the value you wish to write/read/delete.
[DATA] is what you want to write to the key
[DEFAULT] is what the function will return if for some reason the value can not be read properly and
IS OPTIONAL.
Please pay attention to where quote marks are located. If the information is stored in a variable you would of course omit the quotes.
Keys
Creating
Code:
CreateRegKey([HKEY], "[PATH]")
Deleting
Code:
DeleteRegKey([HKEY], "[PATH]")
Values
Deleting
Code:
DeleteRegValue([HKEY], "[PATH]", "[VALUE]")
Creating/Writing String, Longs(DWords), and Binary(Byte) data
Code:
SaveSettingString([HKEY], "[PATH]", "[VALUE]", "[DATA]")
SaveSettingLong([HKEY], "[PATH]", "[VALUE]", [DATA])
SaveSettingByte([HKEY], "[PATH]", "[VALUE]", [DATA])
Reading String, Long, and Binary data
Code:
dim strString as String
dim lngLong as Long
dim intBinary as Integer
strString = GetSettingString([HKEY], "[PATH]", "[VALUE]", "[DEFAULT]")
lngLong = GetSettingLong([HKEY], "[PATH]", "[VALUE]", [DEFAULT])
intBinary = GetSettingByte([HKEY], "[PATH]", "[VALUE]", [DEFAULT])
Well that about covers all the practical purposes of the registry. Remember to add the module to your program and remember all your registry values should be in the HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER under the Software sub key under a subkey of your own creation, unless you are trying to do something odd such as get your program to start with windows in which case you would have to write it to the appropriate place. Good Luck.