by Michael Drotar (3 Submissions)
Category: Libraries
Compatability: Visual Basic 5.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (4 Votes)
Included in this module are several functions to help you in handling with the registry. I have written and tested these as best I can. You may use them at your own risk. I frequently use SetAppKeyValue and GetAppKeyValue without any problems. If you wish to alter or test any of the functions, I strongly advise you to backup your registry first (Start > Run "regedit").
The included functions are:
CloseKey,
CreateKey,
DeleteKey,
DeleteKeyStruct,
EnumKey,
GetAppKeyValue,
GetKeyValue,
OpenKey,
SetAppKeyValue, and
SetKeyValue.
This code covers:
Constants,
Functions,
GoTo,
On Error,
Recursion,
RegCloseKey API,
RegCreateKeyEx API,
RegDeleteKey API,
RegEnumKeyEx API,
RegQueryValueEx API,
RegOpenKeyEx API,
RegSetValueEx API, and
Types.
API DeclarationsDeclare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long