Solved

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

Posted on 2006-11-05
3
1,866 Views
Last Modified: 2009-06-06
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


0
Comment
Question by:tjeffryes
3 Comments
 
LVL 27

Expert Comment

by:Ark
ID: 17878906
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
0
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 17880244
This was the code I had posted.

Dim WshShell, arrValues, intIndex, varValue
Set WshShell = WScript.CreateObject("WScript.Shell")
arrValues = WshShell.RegRead("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\0a0d020000000000c000000000000046\001f041a")
Set WshShell = Nothing
For intIndex = LBound(arrValues) To UBound(arrValues) Step 2
     varValue = varValue & Chr(arrValues(intIndex))
Next
arrValues = split(varValue, ";")
For intIndex = LBound(arrValues) To UBound(arrValues)
    Wscript.Echo arrValues(intIndex)
Next
0
 
LVL 1

Author Comment

by:tjeffryes
ID: 17880358
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
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now