Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to pass Variant array from ASP to COM?

How to pass Variant array from ASP to COM?

Scheduled Pinned Locked Moved Web Development
c++comsysadmindata-structureshelp
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MikeBaker
    wrote on last edited by
    #1

    I have been trying (unsuccessfully) to pass an array of Variants to a C++ COM component from an ASP page. I wind up getting a 'Type Mismatch' error when the ASP tries to call the COM method. Below is the ASP and the C++ declarations for what I have tried. Anybody see what I am doing wrong? Thanks in advance! Mike Baker ------------------------- //ASP Dim MyArray(2) Dim MyString Dim MyObj Dim RC MyString = "Hello" MyArray(0) = "One" MyArray(1) = 2 MyArray(2) = MyString Set MyObj = Server.CreateObject(" ... ") RC = MyObj.Method( MyArray ) //C++ #1 STDMETHOD(Method) ( /*[in,out]*/ SAFEARRAY ** pArray, /*[out,retval]*/ long * pnReturnCode ); //C++ #2 STDMETHOD(Method) ( /*[in,out]*/ VARIANT * pArray, /*[out,retval]*/ long * pnReturnCode );

    M 1 Reply Last reply
    0
    • M MikeBaker

      I have been trying (unsuccessfully) to pass an array of Variants to a C++ COM component from an ASP page. I wind up getting a 'Type Mismatch' error when the ASP tries to call the COM method. Below is the ASP and the C++ declarations for what I have tried. Anybody see what I am doing wrong? Thanks in advance! Mike Baker ------------------------- //ASP Dim MyArray(2) Dim MyString Dim MyObj Dim RC MyString = "Hello" MyArray(0) = "One" MyArray(1) = 2 MyArray(2) = MyString Set MyObj = Server.CreateObject(" ... ") RC = MyObj.Method( MyArray ) //C++ #1 STDMETHOD(Method) ( /*[in,out]*/ SAFEARRAY ** pArray, /*[out,retval]*/ long * pnReturnCode ); //C++ #2 STDMETHOD(Method) ( /*[in,out]*/ VARIANT * pArray, /*[out,retval]*/ long * pnReturnCode );

      M Offline
      M Offline
      Michela 0
      wrote on last edited by
      #2

      I don't know if you already solved your problem. I spent a long time with a C++ component called by a ASP page and I remember that the output parameter can only be a VARIANT* (you have long), perhaps the problem isn't in the input parameter but in the output. Hope it helps. Michela

      M 1 Reply Last reply
      0
      • M Michela 0

        I don't know if you already solved your problem. I spent a long time with a C++ component called by a ASP page and I remember that the output parameter can only be a VARIANT* (you have long), perhaps the problem isn't in the input parameter but in the output. Hope it helps. Michela

        M Offline
        M Offline
        MikeBaker
        wrote on last edited by
        #3

        Thanks for the reply. You are exactly correct. The problem is that all of the [out] parms need to be VARIANT*. Now it works fine. Thanks again! Mike

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups