Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - Returning an array of objects from C# to COM/C++?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Returning an array of objects from C# to COM/C++?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Returning an array of objects from C# to COM/C++?
    Posted: 19 April 2010 at 11:38am
I have written a COM component in C#. One of the interfaces contains a function that must return a list of objects of another exported interface:
 
[DispId(1)]
void GetList(ref MyClass[] list);
 
This is no rocket science as long as we stay in the world of .NET, but in MFC we find ourselves in hell:
 
void GetList(SAFEARRAY * * list)
{
    static BYTE parms[] = VTS_UNKNOWN;
    InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, test);
}
 
 
Q1: Is this the preferred way of returning an array of objects from a COM object?
 
Q2: How do I instansiate the MyClass objects on the C++ side?
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.