 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sean Guest
|
Posted: Fri Jan 16, 2004 8:18 pm Post subject: Return an IUnknown from automation object |
|
|
Hi,
I'm would like to create a method in my automation object that has an
[out] parameter of type IUnknown *. When I attempt to update the TLB,
it gives the error 'Out parameter requires pointer type'. I thought
the * indicated a pointer type but apparently not. Is there a way to
return an IUnknown?
thanks,
Sean
|
|
| Back to top |
|
 |
John Carlyle-Clarke Guest
|
Posted: Mon Jan 19, 2004 9:10 am Post subject: Re: Return an IUnknown from automation object |
|
|
[email]delphiconsultingguy (AT) yahoo (DOT) com[/email] (Sean) wrote in
news:c9b4f122.0401161218.d64bc0b (AT) posting (DOT) google.com:
| Quote: | Hi,
I'm would like to create a method in my automation object that has
an [out] parameter of type IUnknown *. When I attempt to update
the TLB, it gives the error 'Out parameter requires pointer type'.
I thought the * indicated a pointer type but apparently not. Is
there a way to return an IUnknown?
|
Yes, there is. This is a bit misleading really. The simple answer is
this : use IUnknown**
IIRC, this only occurs if you use IDL rather than Pascal style for the
TLB editor. In Delphi, IUnknown is an interface, but in C (which IDL
derives from) you only ever deal with interface pointers. Therefore,
IUnknown* in IDL is equivalent to IUnknown in Pascal. Therefore, if
you want an interface {reference|pointer} that you can modify (for an
out param) you need IUnknown**.
Just think of IUnknown* or IDispatch* or IWhatever* as interfaces
(since interfaces are only ever pointers, really), and then it makes
sense.
HTH.
|
|
| Back to top |
|
 |
Sean Guest
|
Posted: Tue Jan 20, 2004 7:14 pm Post subject: Re: Return an IUnknown from automation object |
|
|
| Quote: | Yes, there is. This is a bit misleading really. The simple answer is
this : use IUnknown**
|
The answer is as suprisingly obvious as it is unlikely. Many thanks,
Sean
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|