Board index » delphi » Passing Interfaces between COM objects

Passing Interfaces between COM objects

Hello!
I am wondering if it is possible to pass user defined interface between two
com objects as a parameter of a method? It seems like I can not add a
parameter of IMyDispInterface1 type to a method of a com IMyDispInterface2
if IMyDispInterface1 and IMyDispInterface2 are in two different type
libraries. If It is possible, can I do following on a client side:
MyDispInterface1:= IMyDispInterface1(CreateOLEObject('name1'));
MyDispInterface2:= IMyDispInterface2(CreateOLEObject('name2'));
MyDispInterface1.CallMethod(MyDispInterface2); I would appreciate if you can
give me some example showing how to do something like this. Thank you!
 

Re:Passing Interfaces between COM objects


Boris,

In the Type Library Editor, click on the topmost project and add the
type library your other interface resides in to the uses clause. The
interfaces of the other type library will then be available as
parameters.

Gerald

In article <7heqbr$t6...@forums.borland.com>,
  "Boris Makhlin" <boris.makh...@deluxe.com> wrote:

Quote
> Hello!
> I am wondering if it is possible to pass user defined interface
between two
> com objects as a parameter of a method? It seems like I can not add a
> parameter of IMyDispInterface1 type to a method of a com
IMyDispInterface2
> if IMyDispInterface1 and IMyDispInterface2 are in two different type
> libraries. If It is possible, can I do following on a client side:
> MyDispInterface1:= IMyDispInterface1(CreateOLEObject('name1'));
> MyDispInterface2:= IMyDispInterface2(CreateOLEObject('name2'));
> MyDispInterface1.CallMethod(MyDispInterface2); I would appreciate if
you can
> give me some example showing how to do something like this. Thank you!

--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

Re:Passing Interfaces between COM objects


If you have a simple in-proc server there's no problem.
Quote
Boris Makhlin wrote in message <7heqbr$t6...@forums.borland.com>...
>Hello!
...
>MyDispInterface1:= IMyDispInterface1(CreateOLEObject('name1'));
>MyDispInterface2:= IMyDispInterface2(CreateOLEObject('name2'));
>MyDispInterface1.CallMethod(MyDispInterface2); I would appreciate if you
can
>give me some example showing how to do something like this. Thank you!

Other Threads