Board index » delphi » Returning a COM object from method call

Returning a COM object from method call

Hi,

I'm trying to write a COM object that when called will
return an ADO disconnected RecordSet to the caller.  In
VB the call would look like:

Set oRS = oObj.GetRecordSet

I can't figure out how to define the method's return param.
I've imported the ADODB typelib and set the last param of
the function to out/retval with a data type of the ADODB
Recordset, but I keep getting an error message that the
type must be a pointer.  Any ideas?

Thanks,

James.

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:Returning a COM object from method call


Hi,

An interface (accessing an object) is a pointer,
an out parameter (as the out/retval) is a pointer on a type.

=> when the out/retval of an COM method is an interface,
   you HAVE TO declare it as "AnInterface ** ReturnValue"
   (double pointer).

Bye.

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:Returning a COM object from method call


Thanks for the reply, everything is working OK now.

James

In article <81bfhl$sr...@nnrp1.deja.com>,

Quote
  serge_v...@my-deja.com wrote:
> Hi,

> An interface (accessing an object) is a pointer,
> an out parameter (as the out/retval) is a pointer on a type.

> => when the out/retval of an COM method is an interface,
>    you HAVE TO declare it as "AnInterface ** ReturnValue"
>    (double pointer).

> Bye.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads