Pick up String Array from a VB6 DLL

Author Message
Mr.No

  • Total Posts : 7
  • Scores: 0
  • Reward points : 0
  • Joined: 11/18/2005
  • Status: offline
Pick up String Array from a VB6 DLL Wednesday, February 01, 2006 4:59 AM (permalink)
0
Hi

I have a VB6 DLL that I've instantiated from a VBScript script and I want to pick up the String array returned by one of the methods but I'm getting a type mismatch error. Here's an example of what I'm doing.

  Option Explicit
  
  Dim pvArrBatches
  Dim oExport
  
  Set oExport = CreateObject("SampleVB6.Export")
  
  pvArrBatches = oExport.GetBatchList
  
  MsgBox IsArray(pvArrBatches) ' shows True
  Msgbox "Ubound " & Ubound(pvArratches)   '  shows 1 when 2 items are present in the array
  
  Msgbox pvArrBatches(0)  '' Type mismatch error
  
  
  
  


The VB6 DLL exposes a method as follows:

  Public Function GetBatchList() As String()
    ' build string array
     GeBatchList = pvArrStrList   ' where pvArrStrList    is a correcly populated string array
  End Function
  



Is there anyway I could pick up the string array exposed by my VB6 DLL?

Thanks
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Pick up String Array from a VB6 DLL Wednesday, February 01, 2006 5:56 AM (permalink)
    0
    Does this work?

    Msgbox CStr(pvArrBatches(0))
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      Mr.No

      • Total Posts : 7
      • Scores: 0
      • Reward points : 0
      • Joined: 11/18/2005
      • Status: offline
      RE: Pick up String Array from a VB6 DLL Friday, February 03, 2006 9:32 AM (permalink)
      0
      Hi Ebgreen

      No, the Msgbox CStr(pvArrBatches(0)) also generates an error.
      In the meantime I've found this link http://www.dotnet247.com/247reference/msgs/42/211620.aspx which states that you can only pick up arrays of variants.

      Thanks for your input
       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        RE: Pick up String Array from a VB6 DLL Friday, February 03, 2006 9:42 AM (permalink)
        0
        Hmmm...annoying but not completely unexpected since all VBScript vars are variants.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9