Board index » cppbuilder » Help: Fire event from outside com impl module

Help: Fire event from outside com impl module

Hi,

I have an application that has a user interface and I am adding an
automation interface to this.  Most of the com interface I have created
just calls into the main module and from there into other modules which
then handle the functionality.  My problem is that I don't know how to
fire an event from outside of the implementation module.

All the examples I have found seem to simply fire an event in response
to a client calling a com interface function.  I want to fire an event
when something happens in another module of the server.  I'm thinking
that I need to do something like MyInterface->Fire_Event().  Is there
some way of getting a variable to access my application's com interface
so that I can fire the event?  I can't seem to find any evidence of how
the interface is instantiated by the application - just a lot of
template definitions.

Thanks,
Jim Benn

 

Re:Help: Fire event from outside com impl module


James,

Create a constructor in your implementation class, as well as a global
pointer to your object (or a static public data member).

In the constructor of your implementation class, set this pointer to your
this pointer.

Then include the header for your implementation object, and you can use the
global, or the static data member to call the Fire_Event method.

Quote
"James Benn" <jb...@actawr.com> wrote in message

news:3ACA54FA.F8FB9467@actawr.com...
Quote
> Hi,

> I have an application that has a user interface and I am adding an
> automation interface to this.  Most of the com interface I have created
> just calls into the main module and from there into other modules which
> then handle the functionality.  My problem is that I don't know how to
> fire an event from outside of the implementation module.

> All the examples I have found seem to simply fire an event in response
> to a client calling a com interface function.  I want to fire an event
> when something happens in another module of the server.  I'm thinking
> that I need to do something like MyInterface->Fire_Event().  Is there
> some way of getting a variable to access my application's com interface
> so that I can fire the event?  I can't seem to find any evidence of how
> the interface is instantiated by the application - just a lot of
> template definitions.

> Thanks,
> Jim Benn

Re:Help: Fire event from outside com impl module


Thanks for the help.

I put this in place as you suggested (which seemed easier than it should
have been given my earlier confusion) and also set up an event sink as
outlined in the Borland Community TI
(http://community.borland.com/article/1,1410,26734,00.html).

One question remains.  In the call to connect() as outlined in the
article, I need to pass IMyServerEventsPtr.  I passed the reference to
my COM automation server returned from MySvr = CoMySever::Create();
Apparently this is wrong since I get an error claiming "Queryinterface:
No such interface supported".   What should I be passing here and how do
I get or instantiate it?

Thanks again,
Jim Benn

Other Threads