Results 1 to 3 of 3

Thread: COM: IUnknown as method parameter

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    California
    Posts
    2

    Question COM: IUnknown as method parameter

    Can VB accept an IUnknown parameter when called from a VC++ client using a method?

  2. #2
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322

    IUnknown

    Hi there,

    I think you can pass an IUnknown Parameter into VB. Emphasis on the word..."think"

    The reason for this is that the collection class in VB has a _NewEnum Function that is of an IUnknown type. When I create a Collection component DLL and I wrap the functions and methods on an intrinsic Collection class in my component, I need to write a _NewEnum as an IUnknown Function. This function has a hidden property and cant be seen from the client and this is meant for use for client needing to call the collection class thru the use of For Each Ship in Ships...Next.

    If this IUnknown function is not included, you cant use the For Each...Next Loop. Instead you have to use the For i = 0 to Ships.Count...Next Loop which, I think, is less elegant.

    Therefore, I think you can pass an IUnknown Parameter into VB.

    Function _NewEnum() As Unknown
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    California
    Posts
    2
    After hacking away at the problem, we found that we could passed the IUnknown on the client side as a VARIANT. The VB server was then able to get the IUnknown.

    Thanks

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