Howto select events from a connection point?
Author |
Message |
Ed A #1 / 7
|
 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 |
|
 |
Igor Tandetni #2 / 7
|
 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 |
|
 |
Alexander Nickolo #3 / 7
|
 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 |
|
 |
Igor Tandetni #4 / 7
|
 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 |
|
 |
Peter D'Hoy #5 / 7
|
 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 |
|
 |
Igor Tandetni #6 / 7
|
 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 |
|
 |
Peter D'Hoy #7 / 7
|
 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 |
|
|
|