COM Server returning array of objects
Posted on 2005-05-05
In summary I have an in-process COM Server written in C++ that I want to return an array or collection of objects so that a VB Client app or VC++ Client app can then enumerate through that list.
COM Server has 2 interfaces, WidgetManager and Widget. COM Server is created using ATL.
WidgetManager has one method, GetList, that I want to return a list/array/collection of Widget objects. The WidgetManager should return its list of global Widget data. The idea is that the Client calls WidgetManager.GetList() to get a list of Widgets. I only want the Client to have a copy of th Widgets. Client then goes through the list calling methods on the Widget interface for each Widget in the collection.
The Client can be Visual Basic or VC++ only so don't need to support Automation.
Question :- what should my GetList() method signature look like ? I need to define this for the application programmers - VB or VC++.
Could anybody give me some sample code ?