I am working on some C++ code that I would like to convert to VB.
I have a message callback and the LPARAM being passed back is a struct (called X here). The C++ line of code is:
memcpy &x, (BYTE*)lParam, 64
Anyways.. I have struct X as a UDT, setup my subclassing, and added my RtlMoveMemory declare. Here is my line of code in my VB app:
dim x as x_udt
CopyMemory x, cbyte(lparam),64
My problem is that the UDT x does not have any data filled in. It looks like I just dim'ed it and that's it. I have also tried various combinations using VarPtr and Byval but I get the same result. I know I have to use CByte() otherwise it crashes. It's as if the UDT is being passed back by value instead of by reference.
I know (or I think anyways) that 64 is the correct length since that is what both Sizeof(x) in C++ and Len(x) in VB are returning.
Any ideas?
I have a message callback and the LPARAM being passed back is a struct (called X here). The C++ line of code is:
memcpy &x, (BYTE*)lParam, 64
Anyways.. I have struct X as a UDT, setup my subclassing, and added my RtlMoveMemory declare. Here is my line of code in my VB app:
dim x as x_udt
CopyMemory x, cbyte(lparam),64
My problem is that the UDT x does not have any data filled in. It looks like I just dim'ed it and that's it. I have also tried various combinations using VarPtr and Byval but I get the same result. I know I have to use CByte() otherwise it crashes. It's as if the UDT is being passed back by value instead of by reference.
I know (or I think anyways) that 64 is the correct length since that is what both Sizeof(x) in C++ and Len(x) in VB are returning.
Any ideas?