Howto select events from a connection point? 
Author Message
 Howto select events from a connection point?

Hi all:

I have a few events that get fired as part of my
connection point. Some clients might not need to get
notification on all events. How can I tell the server to
advise me on some selected events?

Thanks



Sun, 11 Jul 2004 02:46:38 GMT  
 Howto select events from a connection point?
The server can provide multiple outgoing interfaces. The client can
implement and sink some or all of them. It is impossible to subscribe to
a part of an outgoing interface - once a set of events is grouped into a
source interface, the client can subscribe to all or none of them. So
you can split your events among multiple interfaces, up to an extreme
case of one interface per event.

Having said that, be aware that many clients, including VB and scripting
languages, can only subscribe to default source interface, so multiple
outgoing interfaces are lost on them. Usually it is not a problem at all
for a client to simply ignore the event it is not interested in. To
accomodate those clients, you can have a default interface that contains
all events, as well as more specific interfaces that contain only
certain subsets. Of course you will then have to fire an event to two
connection points.

Honestly, I have a hard time envisioning a scenario where having all
events in one interface poses a problem, and the technique described
above may be of practical interest.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:

> Hi all:

> I have a few events that get fired as part of my
> connection point. Some clients might not need to get
> notification on all events. How can I tell the server to
> advise me on some selected events?

> Thanks



Sun, 11 Jul 2004 03:18:56 GMT  
 Howto select events from a connection point?
Also, note that dispinterfaces are not COM interfaces, so the sink
may implement only a portion of the whole interface. This is only
true about dispinterface events though.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> The server can provide multiple outgoing interfaces. The client can
> implement and sink some or all of them. It is impossible to subscribe to
> a part of an outgoing interface - once a set of events is grouped into a
> source interface, the client can subscribe to all or none of them. So
> you can split your events among multiple interfaces, up to an extreme
> case of one interface per event.

> Having said that, be aware that many clients, including VB and scripting
> languages, can only subscribe to default source interface, so multiple
> outgoing interfaces are lost on them. Usually it is not a problem at all
> for a client to simply ignore the event it is not interested in. To
> accomodate those clients, you can have a default interface that contains
> all events, as well as more specific interfaces that contain only
> certain subsets. Of course you will then have to fire an event to two
> connection points.

> Honestly, I have a hard time envisioning a scenario where having all
> events in one interface poses a problem, and the technique described
> above may be of practical interest.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > Hi all:

> > I have a few events that get fired as part of my
> > connection point. Some clients might not need to get
> > notification on all events. How can I tell the server to
> > advise me on some selected events?

> > Thanks



Sun, 11 Jul 2004 05:56:57 GMT  
 Howto select events from a connection point?
That's what I meant when I said the client can easily ignore the event
it is not interested in. The server still has to fire all events to all
registered sinks - there's no way to let it know that a particular
client is not interested in a particular event. And that's exactly what,
if I understand correctly, the OP tries to avoid.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Also, note that dispinterfaces are not COM interfaces, so the sink
may implement only a portion of the whole interface. This is only
true about dispinterface events though.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> The server can provide multiple outgoing interfaces. The client can
> implement and sink some or all of them. It is impossible to subscribe
to
> a part of an outgoing interface - once a set of events is grouped into
a
> source interface, the client can subscribe to all or none of them. So
> you can split your events among multiple interfaces, up to an extreme
> case of one interface per event.

> Having said that, be aware that many clients, including VB and
scripting
> languages, can only subscribe to default source interface, so multiple
> outgoing interfaces are lost on them. Usually it is not a problem at
all
> for a client to simply ignore the event it is not interested in. To
> accomodate those clients, you can have a default interface that
contains
> all events, as well as more specific interfaces that contain only
> certain subsets. Of course you will then have to fire an event to two
> connection points.

> Honestly, I have a hard time envisioning a scenario where having all
> events in one interface poses a problem, and the technique described
> above may be of practical interest.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > Hi all:

> > I have a few events that get fired as part of my
> > connection point. Some clients might not need to get
> > notification on all events. How can I tell the server to
> > advise me on some selected events?

> > Thanks



Sun, 11 Jul 2004 06:15:33 GMT  
 Howto select events from a connection point?
On Tue, 22 Jan 2002 14:18:56 -0500, "Igor Tandetnik"

Quote:

>Having said that, be aware that many clients, including VB and scripting
>languages, can only subscribe to default source interface, so multiple
>outgoing interfaces are lost on them.

... but you can easily define a 'dummy' class that exposes the default
interface but has your specific outgoing interface as default
source...

as in following incomplete IDL:

coclass MyClass
{
                [default]       interface MyInterface;
                [default,source]        interface MySinkInterface;

Quote:
};

coclass MyDummyClass
{
                [default]       interface MyInterface;
                [default,source]        interface MyLimitedSinkInterface;

Quote:
};

kr,

Peter
--
==========================================
 Peter D'Hoye (speaking only for himself)
 Barco Commercial Printing - R&D - Belgium



Mon, 12 Jul 2004 21:57:53 GMT  
 Howto select events from a connection point?
If I understand you correctly, you intend to have the same C++ class
implement both coclasses, or in other words, register the same server
with two different CLSIDs. That can be a pain if said server needs to
implement, say, IProvideClassInfo(2), which is for example necessary to
fire events from default source interface to script on HTML page. The
class will have to track which CLSID it was created with, which rules
out reusing ATL's CComClassFactory and IProvideClassInfo2Impl.

This can be done, of course, but I fail to see the advantages of this
approach.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> On Tue, 22 Jan 2002 14:18:56 -0500, "Igor Tandetnik"

> >Having said that, be aware that many clients, including VB and
scripting
> >languages, can only subscribe to default source interface, so
multiple
> >outgoing interfaces are lost on them.

> ... but you can easily define a 'dummy' class that exposes the default
> interface but has your specific outgoing interface as default
> source...

> as in following incomplete IDL:

> coclass MyClass
> {
> [default] interface MyInterface;
> [default,source] interface MySinkInterface;
> };
> coclass MyDummyClass
> {
> [default] interface MyInterface;
> [default,source] interface MyLimitedSinkInterface;
> };

> kr,

> Peter
> --
> ==========================================
>  Peter D'Hoye (speaking only for himself)
>  Barco Commercial Printing - R&D - Belgium



Mon, 12 Jul 2004 22:42:23 GMT  
 Howto select events from a connection point?
Well, I'm not into any scripting stuff, and used the mentioned
workaround for some VB clients, and it works.

It just shows I've got little 'deep' knowledge of ATL/COM, just enough
to do the stuff I have to.

kr,
Peter

On Thu, 24 Jan 2002 09:42:23 -0500, "Igor Tandetnik"

Quote:

>If I understand you correctly, you intend to have the same C++ class
>implement both coclasses, or in other words, register the same server
>with two different CLSIDs. That can be a pain if said server needs to
>implement, say, IProvideClassInfo(2), which is for example necessary to
>fire events from default source interface to script on HTML page. The
>class will have to track which CLSID it was created with, which rules
>out reusing ATL's CComClassFactory and IProvideClassInfo2Impl.

>This can be done, of course, but I fail to see the advantages of this
>approach.

kr,

Peter
--
==========================================
 Peter D'Hoye (speaking only for himself)
 Barco Commercial Printing - R&D - Belgium



Sat, 17 Jul 2004 21:40:06 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Problem in firing Events/Connection Points

2. problem receiving events via connection points in atl

3. Connection Points - firing an event to a sink in another process

4. Connection Points executing, events not firng

5. VB Connection points/Events

6. Windowless Control - Connection Points and Events

7. connection points and events

8. Events - no connection points

9. Two interfaces and connection points/events

10. connection points and events

11. Function pointers as an alternative to connection point for event notification - is it a good choice

12. Connection Point Events Across Processes Boundaries?

 

 
Powered by phpBB® Forum Software