Results 1 to 2 of 2

Thread: Registry - RG_BINARY

  1. #1
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 01
    Location
    Manchester, UK
    Posts
    404

    Registry - RG_BINARY

    Hi,

    I'm having difficulty storing values RG_BINARY values in the registry.

    How would I get the folloing hex values "77 4d 3b f5" to display in the registry exactly as they are here.

    When I insert them into the registry the values change sample code below.

    VB Code:
    1. Public Const REG_BINARY = 3 ' Free form binary
    2. Public Const HKEY_LOCAL_MACHINE = &H80000002
    3.  
    4. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    5. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    6. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    7. Private 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
    8. Public Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String)
    9.     Dim Ret
    10.     'Create a new key
    11.     RegCreateKey hKey, strPath, Ret
    12.     'Set the key's value
    13.     RegSetValueEx Ret, strValue, 0, REG_BINARY, strData, LenB(strData)
    14.     'close the key
    15.     RegCloseKey Ret
    16. End Sub
    17.  
    18. Sub main()
    19.   Dim sBand0 As String
    20.  
    21.   'hex
    22.   sBand0 = "774d3bf5"
    23.  
    24.  
    25.   SaveStringLong HKEY_LOCAL_MACHINE, "SOFTWARE\TESTER", "MYVAL", sBand0
    26. End Sub

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 02
    Location
    Other side of town from si_the_geek
    Posts
    7,171
    If you search here you will find lots of modules and example that I am sure will solve your problem.


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

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