Unsubscribing to OCX Events.
Peter.Walker@ubs.com
Monday, November 25, 1996
Environment: VC++ 4.2b, NT 3.51.
I am currently using an OCX as an event sink to other OCX's in my
process. What I wish to do is to implement a Register/Deregister
between my client OCX's and my sink OCX , so that when an event occurs
in my sink OCX it will only be sent to the client OCX's that currently
have registered an interest in that event.
I have looked at overriding COleControl FireEventV/FireEvent but these
aren't virtual anyway.
COleControl::FireEventV seems to be the right area, where it iterates
m_xEventConnPt for dispatches to Invoke. I just wish to toggle which
dispatches to call, for reasons of efficiency.
Peter Walker
Peter.Walker@ubs.com
Giles R. Chamberlin -- GRC@langley.softwright.co.uk
Wednesday, November 27, 1996
Peter Walker asked:
> I am currently using an OCX as an event sink to other OCX's in my
> process. What I wish to do is to implement a Register/Deregister
> between my client OCX's and my sink OCX , so that when an event
occurs
> in my sink OCX it will only be sent to the client OCX's that
currently
> have registered an interest in that event.
Sounds like a candidate for raw OLE: on the OCX firing the event call
IConnectionPoint::Advise and IConnectionPoint::Unadvise to toggle
connection. passing a suitable IDispatch belonging to the receiving OCX.
The events will be fired as ever, but only connected clients will receive
the event.
There have been several discussions on connecting event interfaces on
this list in the last few months,
or mail me direct if you need some more.
Giles Chamberlin
Softwright
| Вернуться в корень Архива
|