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