how do I return an array (COleSafeArray?) using automation?
Posted on 2002-04-29
I am writing two programs which interact with automation, and the client wants to get an array (of floats, actually) back from the server. I set up the server method (GetData) to return a VARIANT, and have tried the following, just as a test for returning a CByteArray:
// ignore VStudio generated stuff
// TODO: Add your dispatch handler code here
for (c=0; c<10; c++)
My client code looks like this
However, this doesn't work. I get exceptions and kernel page faults, and various nasty messages.
Can someone tell me what is the correct way to return an array using automation? What I would really like to return is a COleSafeArray.
Also, if I do this, which program owns the memory, and how do I displose of it? Where should I use Detach(), if at all?