Results 1 to 2 of 2

Thread: Does the value exist in the Registry?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    33

    Exclamation

    I was wondering if theres a way to see if a value
    exists in a specific place in the registry.


    HKEY_CURRENT_USER\Software\APPNAME\SUB\

    Name: "Matthew"
    Data: "password"

    If the name doesn't exist, it comes back as false.

    please help, thanks



  2. #2
    jim mcnamara
    Guest
    This function returns 0 if the key exists.
    Code:
    Const REG_SZ = 1 ' 
    Const REG_BINARY = 3 ' Free form binary
    Const HKEY_CURRENT_USER = &H80000001
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    
    Private 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
    
    
    Function RegQueryStringValue ByVal strValueName As String) As Long
        Dim hKey as Long
        Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long
        hKey= HKEY_CURRENT_USER
        'retrieve nformation about the key
         RegQueryStringValue = _
    RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize)
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width