title: VB6 SendMessage to send custom data type
body: <p>I'm currently successfully using Win32 API's SendMessage function to send text between two threads using the WM_SETTEXT parameter.</p>
  
  <p>What I would like to do is send a custom data type instead of primitive data types.</p>
  
  <p>So let's say I have</p>
  
  <pre><code>Type myType
      a as Integer
      b(5) as Boolean
      d(15) as Double
  End Type
  Dim tmp as myType
  </code></pre>
  
  <p>I would like to be able to:</p>
  
  <pre><code>Call SendMessage(dstHWnd, WM_SETTEXT, 0, tmp)
  </code></pre>
  
  <p>I am guessing I would have to use WM_COPYDATA or similar, but the other issue is this produces a error because my data type cannot be casted into Any, per function definition:</p>
  
  <pre><code>Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
  </code></pre>
  
  <p>Is it possible to coax this conversion? Or is there an alternative best-practices method (fast and optimal)?</p>