==============================
JF Software VB Modules
By Joshua Foster - JF Software
http://www.jfsoftware.net
jfsoftware@jfsoftware.net
June 25, 2001
==============================
Registry class module
=====================
Description: Procedures that work with the Windows Registry.


Procedures:
===========
---------
DeleteKey
---------
Syntax:       DeleteKey(hKey As HKEY_CONSTANTS, strSubKey As String) As Boolean
Description:  Deletes a key (folder of values)
Return Value: Returns true if successful, false if an error occured.
Parameters:   hKey      - The base key that the key resides in (type HKEY_CONSTANTS)
              strSubKey - The key to delete.
Types:        Name:        HKEY_CONSTANTS
              Description: Base keys in the Registry that keys and values reside in.
              Members:     HKEY_CLASSES_ROOT
                           HKEY_CURRENT_CONFIG
                           HKEY_CURRENT_USER
                           HKEY_DYN_DATA
                           HKEY_LOCAL_MACHINE
                           HKEY_PERFORMANCE_DATA
                           HKEY_USERS

Example:
--------
Private cReg As Registry  'Define a Registry object

Private Sub Form_Load()
Set cReg = New Registry  'Load the cReg object
'Delete the entire key HKEY_CLASSES_ROOT\MyApp.Document\shell\Open
Call cReg.DeleteKey(HKEY_CLASSES_ROOT, "MyApp.Document\shell\Open")
End Sub


-----------
DeleteValue
-----------
Syntax:       DeleteValue(ByVal hKey As HKEY_CONSTANTS, ByVal strSubKey As String, strValueTitle As String) As Boolean
Description:  Deletes a value.
Return Value: Returns true if successful, false if an error occured.
Parameters:   hKey          - The base key that the value resides in (type HKEY_CONSTANTS)
              strSubKey     - The key that the value to delete resides in.
              strValueTitle - The value to delete.
Types:        Name:        HKEY_CONSTANTS
              Description: Base keys in the Registry that keys and values reside in.
              Members:     HKEY_CLASSES_ROOT
                           HKEY_CURRENT_CONFIG
                           HKEY_CURRENT_USER
                           HKEY_DYN_DATA
                           HKEY_LOCAL_MACHINE
                           HKEY_PERFORMANCE_DATA
                           HKEY_USERS

Example:
--------
'Delete the value TesterValue in the key HKEY_CLASSES_ROOT\MyApp.Document\shell\Open
Call cReg.DeleteValue(HKEY_CLASSES_ROOT, "MyApp.Document\shell\Open", "TesterValue")


---------
ReadValue
---------
Syntax:       ReadValue(ByVal hKey As HKEY_CONSTANTS, ByVal strSubKey As String, ByVal strValueTitle As String)
Description:  Reads a value from the Registry.
Return Value: Returns the contents of the value
Parameters:   hKey          - The base key that the value resides in (type HKEY_CONSTANTS)
              strSubKey     - The key that the value to read from resides in.
              strValueTitle - The value to read.
Types:        Name:        HKEY_CONSTANTS
              Description: Base keys in the Registry that keys and values reside in.
              Members:     HKEY_CLASSES_ROOT
                           HKEY_CURRENT_CONFIG
                           HKEY_CURRENT_USER
                           HKEY_DYN_DATA
                           HKEY_LOCAL_MACHINE
                           HKEY_PERFORMANCE_DATA
                           HKEY_USERS

Example:
--------
'MsgBox the contents of the value TesterValue in the key
'HKEY_CLASSES_ROOT\MyApp.Document\shell\Open
MsgBox cReg.ReadValue(HKEY_CLASSES_ROOT, "MyApp.Document\shell\Open", "TesterValue")
End Sub


----------
WriteValue
----------
Syntax:       WriteValue(ByVal hKey As HKEY_CONSTANTS, ByVal strSubKey As String, ByVal strValueTitle As String, ByVal _
              anyValue) As Boolean
Description:  Writes a string or long value to the Registry. (default)
Return Value: Returns true if successful, false if an error occured.
Parameters:   hKey          - The base key that the value resides in (type HKEY_CONSTANTS)
              strSubKey     - The key that the value to write to resides in.
              strValueTitle - The value to write to.
              anyValue      - The new contents of the value.
Types:        Name:        HKEY_CONSTANTS
              Description: Base keys in the Registry that keys and values reside in.
              Members:     HKEY_CLASSES_ROOT
                           HKEY_CURRENT_CONFIG
                           HKEY_CURRENT_USER
                           HKEY_DYN_DATA
                           HKEY_LOCAL_MACHINE
                           HKEY_PERFORMANCE_DATA
                           HKEY_USERS

Example:
--------
'Set the contents of the value TesterValue in the key
'HKEY_CLASSES_ROOT\MyApp.Document\shell\Open to "Hello, world!"
Call cReg.WriteValue(HKEY_CLASSES_ROOT, "MyApp.Document\shell\Open", "TesterValue", "Hello, world!")
End Sub
