To make sense of all the information presented in the preceding sections, we need to see how the Registry APIs are used. To do that, we have created a module to perform the five most widely used functions: create a key, set a key value, read that value, delete the value, and, of course, delete the key itself.
Create a new standard module and add the following declarations to it (you can find a complete list in Appendix J). Note the addition of two enums: w32Key and w32ValueType. These enums are useful when actually writing the procedures, so you don't have to remember all the constant declarations.
Notice also that all the declarations are now Public. This allows them to be accessed from anywhere in our application. If you were to create a class to wrap all your Registry functions, the declarations would still need to be in a standard module, and they would still need to be declared Public.
'Key declarations Public Const HKEY_CLASSES_ROOT As Long = &H80000000 Public Const HKEY_CURRENT_CONFIG As Long = &H80000005 Public Const HKEY_CURRENT_USER As Long = &H80000001 Public Const HKEY_DYN_DATA As Long = &H80000006 Public Const HKEY_LOCAL_MACHINE As Long = &H80000002 Public Const HKEY_PERF_ROOT As Long = HKEY_LOCAL_MACHINE Public Const HKEY_PERFORMANCE_DATA As Long = &H80000004 Public Const HKEY_USERS As Long = &H80000003s
'Root key Enum Public Enum w32Key w32CLASSES_ROOT = HKEY_CLASSES_ROOT w32CURRENT_CONFIG = HKEY_CURRENT_CONFIG w32CURRENT_USER = HKEY_CURRENT_USER ...