I need to pass an STL Vector to a Visual Basic program using COM. This has to be a vector of a user defined structure and it has to also be within a structure itself.
As near as I can tell, I have all of the pieces working. I can create a structure within a structure that COM can use. Using a generic type, I can create a vector that COM can pass to VB. Using a structure that COM can pass to VB, I can create a vector, but I can't get COM to pass that structure to VB.
I am following this MSDN article on how to pass STL containers through COM.
http://msdn2.microsoft.com/en-us/library/3stwxh95(VS.80).aspx
The article is pretty good, but it is just passing strings and doesn't talk at all about UDT's.
Some more specifics... I am trying to implement the get_Item method which should, given an index, return the object stored in the vector at the index. I don't know if the 'return' variable type should be a CComVariant, an IUnknown, one of my structs or what... It would make sense for it to be one of my structs, but it appears that for VB to recognize it, it has to be one of the other two mentioned. I don't know if this would work with ANY struct that VB can see through the COM interface.
If anyone can help me, I would be grateful.
- Matt