Results 1 to 15 of 15

Thread: [ADVANCED] - Passing structures via WM_COPYDATA [SOLVED]

Threaded View

  1. #1

    Thread Starter
    Lively Member Axonn's Avatar
    Join Date
    May 2005
    Posts
    64

    Resolved [ADVANCED] - Passing structures via WM_COPYDATA [SOLVED]

    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:
    1. Public Type SomeStructure
    2.       xx As Long
    3.       yy As Long
    4. End Type

    Of course, I use COPYDATASTRUCT like this:

    VB Code:
    1. Public Type CopyDataStruct
    2.       dwData As Long
    3.       cbData As Long
    4.       lpData As Long
    5. End Type

    And the variables are:
    VB Code:
    1. Public cpy As CopyDataStruct
    2. Public some As SomeStructure

    And the call is:

    VB Code:
    1. some.xx = 4
    2.    some.yy = 6
    3.    
    4.    cpy.cbData = 8
    5.    cpy.dwData = 101
    6.    cpy.lpData = VarPtr(nu)
    7.    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?
    Last edited by Axonn; Nov 12th, 2005 at 06:29 PM.
    . - = E C H Y S T T A S = - .
    The Greater Mind Balance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width