Board index » cppbuilder » getting access to non-default interfaces

getting access to non-default interfaces


2004-11-10 07:24:18 PM
cppbuilder21
Hello!
I'm having problems on getting access to methods of non-default interfaces
when I implement multiple interfaces in a CoClass.
I have a type library with several automation-object CoClasses, each added
with the expert and providing different features through several methods. I
also want to have an additional CoClass which implements all features of the
other CoClasses, so I added all interfaces in the implementation-tab of this
CoClass and after refreshing the tlb I can see that my Impl-file was updated
with the methods of the added interfaces.
But how can I access these methods in my client? I implemented the server
with a component-wrapper through importing the tlb on client side and
naturally I call the methods directly. But that seems to result in a
limitation of calls for default-interface-methods because of the integrated
GetDefaultInterface-method. So do I have to do manual calls to get access to
the other methods or is the implementation of the interfaces on server side
wrong?
Thanks,
Chris
 
 

Re:getting access to non-default interfaces

"Chris" < XXXX@XXXXX.COM >wrote in message
Quote
I also want to have an additional CoClass which implements all
features of the other CoClasses, so I added all interfaces in the
implementation-tab of this CoClass
How about instead creating a new single interface just for that second
CoClass, and then have that interface derive from the other interfaces?
Gambit
 

Re:getting access to non-default interfaces

Hm....never thought about it because I missed a multiple-deriving option for
interfaces in the type library editor.
There is only an option to inherite from 1 interface, so do I have to add
the other interfaces manually?
Thanks again,
Chris
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

"Chris" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>I also want to have an additional CoClass which implements all
>features of the other CoClasses, so I added all interfaces in the
>implementation-tab of this CoClass

How about instead creating a new single interface just for that second
CoClass, and then have that interface derive from the other interfaces?


Gambit


 

{smallsort}

Re:getting access to non-default interfaces

"Chris" < XXXX@XXXXX.COM >wrote in message
Quote
Hm....never thought about it because I missed a
multiple-deriving option for interfaces in the type
library editor.
It is not in the editor, but you can implement it manually in the Impl code.
Derive the interface from IUnknown or IDispatch as needed, and then add the
other various Impl classes to the ancestor list of the interface declaration
in the Impl's header file. The Impl class can have multiple ancestors as
desired, they don't need to be part of the TLB. Also, add the various
interfaces to the COM_MAP as well. That way, at runtime you should now be
able to instantiate the interface via its CoClass and then call
QueryInterface() on it to get the other interfaces from it, and then call
their respective methods as needed.
Gambit