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:
Public Const REG_BINARY = 3 ' Free form binary Public Const HKEY_LOCAL_MACHINE = &H80000002 Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 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 Public Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String) Dim Ret 'Create a new key RegCreateKey hKey, strPath, Ret 'Set the key's value RegSetValueEx Ret, strValue, 0, REG_BINARY, strData, LenB(strData) 'close the key RegCloseKey Ret End Sub Sub main() Dim sBand0 As String 'hex sBand0 = "774d3bf5" SaveStringLong HKEY_LOCAL_MACHINE, "SOFTWARE\TESTER", "MYVAL", sBand0 End Sub


Reply With Quote