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. General Programming
  3. COM
  4. How do I return an array of objects in C++ to my ASP page.

How do I return an array of objects in C++ to my ASP page.

Scheduled Pinned Locked Moved COM
data-structuresquestionc++databasecom
3 Posts 2 Posters 9 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.
  • N Offline
    N Offline
    notjeff
    wrote on last edited by
    #1

    I know how to return an array of variants, such as if I wanted to return an array of integers. What I would like to do is along the lines of returning an array of C++ objects. Here is what I'd like to do: ASP Pseudo Code: <% 'First, get a connection to my catalog component. Set objCatalog = Server.CreateObject("my.Catalog.1") 'Now ask my catalog to find me all itmes that match 'the text I send and return them to me. Set objItems = objCatalog.Find("Books about ASP") 'For each item display its name, price, and then all 'of its pictures. For i = 0 to objItems.Count response.write objItems(i).name response.write objItems(i).price ' Now each book will have 0-20 picutres ' I'll need to have an array of strings ' with the URL to each picture SomeFunctionToGetAndOutHTMLtoShowPictures(objItems(i).pictures) Next %> So my question is how do I get my C++ component to return an array of catalog item "objects." This data is not coming from a database else, I'd just use ADO. My COM component goes out and grabs it dynamically and stores it in a linked list of Catalog objects. Now I just need to know how to get these darn things back to my ASP pages! :) I've searched high and low on Microsofts site and bought 3 books, but none of them cover anything like this. I'd appreciate any help, hints, scraps, anything at all to even point me in the right direction. I'm going bonkers trying to figure this out. Thanks NJ

    A 1 Reply Last reply
    0
    • N notjeff

      I know how to return an array of variants, such as if I wanted to return an array of integers. What I would like to do is along the lines of returning an array of C++ objects. Here is what I'd like to do: ASP Pseudo Code: <% 'First, get a connection to my catalog component. Set objCatalog = Server.CreateObject("my.Catalog.1") 'Now ask my catalog to find me all itmes that match 'the text I send and return them to me. Set objItems = objCatalog.Find("Books about ASP") 'For each item display its name, price, and then all 'of its pictures. For i = 0 to objItems.Count response.write objItems(i).name response.write objItems(i).price ' Now each book will have 0-20 picutres ' I'll need to have an array of strings ' with the URL to each picture SomeFunctionToGetAndOutHTMLtoShowPictures(objItems(i).pictures) Next %> So my question is how do I get my C++ component to return an array of catalog item "objects." This data is not coming from a database else, I'd just use ADO. My COM component goes out and grabs it dynamically and stores it in a linked list of Catalog objects. Now I just need to know how to get these darn things back to my ASP pages! :) I've searched high and low on Microsofts site and bought 3 books, but none of them cover anything like this. I'd appreciate any help, hints, scraps, anything at all to even point me in the right direction. I'm going bonkers trying to figure this out. Thanks NJ

      A Offline
      A Offline
      Alex Gorev
      wrote on last edited by
      #2

      Hi, Returning an object to VBScript means returning an Interface of the object. It can be IDispatch or any other IDispatch derived interface. You can create and return a safearray of variants, where each variant holds an IDispatch to your object... but I think the best thing to do is to implement a collection of objects. Regards, Alex Gorev, Dundas Software.

      N 1 Reply Last reply
      0
      • A Alex Gorev

        Hi, Returning an object to VBScript means returning an Interface of the object. It can be IDispatch or any other IDispatch derived interface. You can create and return a safearray of variants, where each variant holds an IDispatch to your object... but I think the best thing to do is to implement a collection of objects. Regards, Alex Gorev, Dundas Software.

        N Offline
        N Offline
        notjeff
        wrote on last edited by
        #3

        Thank you. We are a Dundas customer BTW. NotJeff

        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