dcsimg
June 20, 2018
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.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date