CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    China SHaanxi Xi'an
    Posts
    11

    how to pass a array

    I had a ATL class,
    It has a method,
    the method retrieves a array,
    for examples:
    MyMethod([in] VARIANT myArray)

    it can't work
    when I create instance follow:
    Dim x as Object
    Set x = CreateObject("MyObjectID")
    Dim a(10)
    X.MyMethod a

    but it work normally follow:
    Dim x as New MyObjectTypeLib.MyObjectID
    Dim a(10)
    X.MyMethod a

    Why?

    Who can help me?

    Thanks

    jiatiejun

  2. #2
    Join Date
    Apr 2000
    Location
    San Francisco, California, USA
    Posts
    4,467

    Re: how to pass a array

    Check the type of the variant that is passed in using the first method.
    Chances are it is VT_BYREF|VT_VARIANT, so you should "dereference" it
    using VariantCopyInd function.

    Russian Software Development Network -- http://www.rsdn.ru

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

Featured