BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Return an IUnknown from automation object

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Sean
Guest





PostPosted: Fri Jan 16, 2004 8:18 pm    Post subject: Return an IUnknown from automation object Reply with 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?

thanks,
Sean
Back to top
John Carlyle-Clarke
Guest





PostPosted: Mon Jan 19, 2004 9:10 am    Post subject: Re: Return an IUnknown from automation object Reply with quote



[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





PostPosted: Tue Jan 20, 2004 7:14 pm    Post subject: Re: Return an IUnknown from automation object Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.