Hi everybody ::- D. Does anybody know how to get the size of a structure in Visual Basic? I need this to pass a structure to VC++ via WM_COPYDATA ::- ). The structure is this:
VB Code:
Public Type SomeStructure xx As Long yy As Long End Type
Of course, I use COPYDATASTRUCT like this:
VB Code:
Public Type CopyDataStruct dwData As Long cbData As Long lpData As Long End Type
And the variables are:
VB Code:
Public cpy As CopyDataStruct Public some As SomeStructure
And the call is:
VB Code:
some.xx = 4 some.yy = 6 cpy.cbData = 8 cpy.dwData = 101 cpy.lpData = VarPtr(nu) SendMessage 131198, WM_COPYDATA, Me.hwnd, cpy
And of course, the error is: OVERFLOW.
It's probably 'cause of that cbData = 8. I am not sure if the size of the structure is 8 bytes. It's two longs so it should be, right? But isn't there some command to find that out?




Reply With Quote