Link to home
Start Free TrialLog in
Avatar of tjeffryes
tjeffryesFlag for United States of America

asked on

How do you read a REG_BINARY value from the registry using VB?

In all my VBA work, I generally only retrieve string values from the registry or simple REG_DWORD values.  I really don't know how to decode the binary values.   Does it require a Windows API call if I'm not using .NET?  
 
Please note:  This question has already been answered by BlueDevilFan and I'm posting here so that other people can find it and so that I can award him/her the points.  

Please don't bother answering this unless you are BlueDevilFan.  

Thanks!!!!


Tim Jeffryes


Avatar of Ark
Ark
Flag of Russian Federation image

Private Sub Command1_Click()
   Dim wshShell As Object
   Dim arrData, i, sData
   Set wshShell = CreateObject("WScript.Shell")
   arrData = wshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop\Default TaskBar")
'Now arrData contains a VBArray of integers with members equal to byte sequence in registry key
   For i = 0 To UBound(arrData)
      If sData <> "" Then sData = sData & " "
      sData = sData & Right("0" & Hex(arrData(i)), 2)
   Next i
   Debug.Print sData
   Set wshShell = Nothing
End Sub
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjeffryes

ASKER

thanks, Ark, for your response.  It looks nearly identical to BlueDevilFan's, but as I noted in my positing, I had already "pre-rewarded" him the points.  

thanks everybody.

Tim Jeffryes