dcsimg
December 4, 2016
Hot Topics:

Create a Registry Control

  • November 19, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

Add a module (mDeclares). Copy the following code into the module:

'Registry Constants
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const HKEY_PERFORMANCE_DATA = &H80000004
Public Const ERROR_SUCCESS = 0&
Public Const REG_SZ = 1 ' Unicode nul
                        ' terminated string
Public Const REG_DWORD = 4
 
'Registry API Declarations
Public Declare Function RegCloseKey _
     Lib "advapi32.dll" _
     (ByVal HKey As Long) As Long

Public Declare Function RegCreateKey _
     Lib "advapi32.dll" Alias "RegCreateKeyA" _
        (ByVal HKey As Long, _
         ByVal lpSubKey As String, _
         phkResult As Long) As Long

Public Declare Function RegDeleteKey _
    Lib "advapi32.dll" Alias "RegDeleteKeyA" _
        (ByVal HKey As Long, _
        ByVal lpSubKey As String) As Long

Public Declare Function RegDeleteValue _
    Lib "advapi32.dll" Alias "RegDeleteValueA" _
        (ByVal HKey As Long, 
         ByVal lpValueName As String) As Long

Public Declare Function RegOpenKey _
    Lib "advapi32.dll" Alias "RegOpenKeyA" _
        (ByVal HKey As Long, _
         ByVal lpSubKey As String, _
         phkResult As Long) As Long

Public 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

Public Declare Function RegSetValueEx _
    Lib "advapi32.dll" Alias "RegSetValueExA" _
        (ByVal HKey As Long, ByVal lpValueName As String, _
         ByVal Reserved As Long, _
         ByVal dwType As Long, lpData As Any, _
         ByVal cbData As Long) As Long




Page 2 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel