|

VBCE
Registry Test.zip
(8.5k)
The "Registry_Manipulation.bas" module included
on this example include the following public functions:
Public Function GetAllRegistrySettings(
_
ByVal root As Long, _
Byval KeyPath As String)
Public Function GetRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal ValueName As String, _
ByRef keyV_Type As Long)
Public Sub SaveRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal ValueName As String, _
ByVal keyV_Type As Long, _
ByVal NewData As String)
Public Sub DeleteRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal SubKey As String)
Public Sub DeleteRegistryKey( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal KeyName As String)
NOTE: These functions can manipulate any Registry Setting and should
be used VERY CAREFULLY.
The "root" values have been defined as constants:
' Reg Key ROOT Types
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
as long as the "keyV_Type" values:
' Reg Data Types...
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD_LITTLE_ENDIAN = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_MULTI_SZ = 7
This module also include "clones" of the regular Visual
Basic registry settings functions, including:
Public Function GetSetting(
_
ByVal appname As String, _
ByVal section As String, _
ByVal key As String, _
ByVal default As String)
Public Sub SaveSetting( _
ByVal appname As String, _
ByVal section As String, _
ByVal key As String, _
ByVal setting As String)
Public Function DeleteSetting( _
ByVal appname As String, _
ByVal section As String, _
ByVal key As String)
Public Function GetAllSettings( _
ByVal appname As String, _
ByVal section As String)
which will protect the registry from unrecoverable damage.
There are, however, some differences between these functions and
the regular counterparts:
The test program performs the following actions:
 |
"Program Settings" and
"Enumerate" use the VB functions counterparts - try
to "Write" and "Read" some settings. Then
"Enumerate" them. When you're finished clean the registry
by "Erase"ing each setting.
 |
 |
With "Read Registry" you
can "Read" any setting - try it with the values left
in the boxes. This a special "Multi-String" setting.
 |
 |
On "Write Registry" you
can only write on a specific location - the 3 first boxes are
disabled (this is just to protect your registry...) "Multi-String
is not supported but there's commented code on the Form.
|
Enjoy,
ComMEDIA, Lda.
|