It generally seems to be working now with setting everything to a Long... I guess I thought alignment meant something else. I thought it meant as described in post #8 above... but that's not the same thing..
b is at byte 4, but then j would start at byte 5, not byte 6 (how is that aligned to 4 anyway? it's aligned to 2.) or byte 8 if each member was padded to 4 bytes.
And I also would really like to know out of the hundreds of interfaces I've worked with in the past 18 months why this one member of this one function is displaying this uniquely odd behavior.
Anyway, this works:
PVC key={259ABFFC-50A7-47CE-(AF,8,68,C9,A7,D7,33,66),pid=12Code:Private Sub IMMNotificationClient_OnPropertyValueChanged(ByVal pwstrDeviceId As Long, _ ByVal L As Long, _ ByVal w12 As Long, _ ByVal B0123 As Long, _ ByVal B4567 As Long, _ ByVal pid As Long) Dim bt1(3) As Byte Dim bt2(3) As Byte Dim w1 As Integer Dim w2 As Integer CopyMemory ByVal VarPtr(w1), ByVal VarPtr(w12), 2& CopyMemory ByVal VarPtr(w2), ByVal (VarPtr(w12) + 2), 2& CopyMemory ByVal VarPtr(bt1(0)), ByVal VarPtr(B0123), 4& CopyMemory ByVal VarPtr(bt2(0)), ByVal VarPtr(B4567), 4& Debug.Print "PVC key={" & Hex$(L) & "-" & Hex$(w1) & "-" & Hex$(w2) & "-(" & Hex$(bt1(0)) & "," & Hex$(bt1(1)) & "," & Hex$(bt1(2)) & "," & Hex$(bt1(3)) & "," & Hex$(bt2(0)) & "," & Hex$(bt2(1)) & "," & Hex$(bt2(2)) & "," & Hex$(bt2(3)) & ")" & ",pid=" & pid End Sub




Reply With Quote
