If x is long and x = &H01020304, at address VarPtr(x) is located &H04; VarPtr(x) + 1 - &H03...
But, of course, Hex$(x, 8) will display 01020304.
Code:
#Compile Exe #Register None Type strTest One As Long Two As Long End Type Function PbMain Dim x As strTest x.One = &H01020304 x.Two = &H55667788 MsgBox Hex$(x.One, 8) MsgBox Hex$(x.Two, 8) Dim b As Byte Ptr b = VarPtr(x) MsgBox Hex$(@b[0], 2) + Hex$(@b[1], 2) + Hex$(@b[2], 2) + Hex$(@b[3], 2) MsgBox Hex$(@b[4], 2) + Hex$(@b[5], 2) + Hex$(@b[6], 2) + Hex$(@b[7], 2) End Function
Leave a comment: