by Angsuman Banerji (23 Submissions)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 4th January 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
To Set BINARY values from the registry
API Declarations
Dim i As Long
Dim lC As Long
Dim bR As Byte
Dim bG As Byte
Dim bB As Byte
Dim bOut() As Byte
' QBColors:
ReDim bOut(0 To 15 * 3 - 1) As Byte
For i = 1 To 15
' Get the Red, Green, Blue for the QBColor at index i:
lC = QBColor(i)
bR = (lC And &HFF&)
bG = ((lC And &HFF00&) \ &H100&)
bB = ((lC And &HFF0000) \ &H10000)
' Add Red, Green, Blue to the byte array to store:
bOut((i - 1) * 3) = bR
bOut((i - 1) * 3 + 1) = bG
bOut((i - 1) * 3 + 2) = bB
Next i
' Store it:
With cR
.ClassKey = HKEY_CURRENT_USER
.SectionKey = "software\vbaccelerator\cRegistry\Binary Test"
.ValueKey = "QBColors"
.ValueType = REG_BINARY
.Value = bOut()
End With