title: In VB6, how do I call a COM object requiring a pointer to an object?
body: <p>I'm having trouble with a .NET Assembly that is com visible, and calling certain methods from VB6.
  What I have found is that if the parameters are well defined types, (e.g. string), calls work fine.  If they are higher level objects, it raises a runtime error '438' suggesting that the property or method is not present.  I suspect that this is a question of having the correct signature on the call, but I can't see how to do this correctly.</p>
  
  <p>I believe that I've done everything correct on the .NET side (ComVisible, public interfaces, etc. and even have it down to a simple enough case).</p>
  
  <p>Looking at the output from the typelib viewer, I have the following:</p>
  
  <pre><code>dispinterface ISimple {
  properties:
  methods:
      [id(0x60020000)]
      void Add([in] ISimpleMember* member);
      [id(0x60020001)]
      ISimpleMember* Create();
  };
  </code></pre>
  
  <p>OK.  So I have 2 methods in my ISimple interface.  One takes an ISimpleMember (Add), whilst the other, returns an ISimpleMember.</p>
  
  <p>The corresponding code in VB looks like this:</p>
  
  <pre><code>Dim item As ISimpleMember
  Dim simple As simple
  Set item = New SimpleMember
  item.S1 = "Hello"
  item.S2 = "World"
  Set simple = New simple
  simple.Add (item)           &lt;---- This raised the run time error 438
  Set item = simple.Create    &lt;---- This works fine, returning me an ISimpleMember
  </code></pre>
  
  <p>I've tried a couple of things:
  1. Dim item as SimpleMember (makes no difference)
  2. simple.Add(ObjPtr(item)) - Syntax error
  3. simple.Add(ByRef item) - Syntax error</p>
  
  <p>Basically, The run time error is the same as if I had 
  simple.AMethodThatIHaventWritten()   </p>
  
  <p>Also, If I browse References in the VB6 Environment, The Add method is well defined:</p>
  
  <p>Sub Add(member As SimpleMember)</p>