Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?
From: david hurkle (david)
Date: 08/09/04
- Next message: david hurkle: "MSFlexGrid in simple ATL container window doesn't accept keystrokes"
- Previous message: david hurkle: "Re: ATL generates bad code for Firing events with [out] arguments"
- In reply to: Alexander Nickolov: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Next in thread: Igor Tandetnik: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Reply: Igor Tandetnik: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 9 Aug 2004 11:57:30 +1000
Yes, that's pretty close, and I can only handle IDispatch with genuine
DISPIDs, not vtables.
Did you mean IProvideClassInfo or IProvideClassInfo2? What would I use the
GUID for?
I guess you mean that I should get the
ITypeInfo->GetTypeAttr()->TYPEATTR.typekind and check it's TKIND_DISPATCH?
I could do that, but I already did it at compile time (I only implement
TKIND_DISPATCH). Will it have changed?
If it's actually a dual interface, how can I be sure it will call using the
IDispatch method?
DavidB
"Alexander Nickolov" <agnickolov@mvps.org> wrote in message
news:eRtYwUBfEHA.1424@tk2msftngp13.phx.gbl...
> Are you implementing the sink at runtime? If not, you can
> always look at the type library to verify it's a pure dispinterface.
> If it's a COM interface, you must implement it accordingly too.
>
> Now, if you are talking about dynamically implementing sinks
> off a type library (like developing a scripting engine for example),
> you can check the type library at runtime. In fact you need to,
> so you can reject (or perhaps properly implement?) real COM
> event interfaces (derived from IUnknown). IProvideClassInfo2
> has been invented with this purpose in mind.
>
> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD
> email: agnickolov@mvps.org
> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================
> "DavidB" <davidb3@Ihatespam.hurkle.com> wrote in message
> news:O5VQc.37019$K53.12415@news-server.bigpond.net.au...
> > So how do I protect myself against claiming to implement an interface I
> > really don't? I thought responding only to IDispatch would do that, but
> > getting called on a vtable I don't have (or actually contains different
> > functions) is not a nice prospect!
> >
> > DavidB
> >
> > "Alexander Nickolov" <agnickolov@mvps.org> wrote in message
> > news:uHCtHR9eEHA.3520@TK2MSFTNGP10.phx.gbl...
> > > An event interface cannot be dual. And yes, you are required to
> > > report it via IUnknown::QueryInterface. However, the event
> > > interface may be a regular COM interface deriving from IUnknown,
> > > so beware :)...
> > >
> > > --
> > > =====================================
> > > Alexander Nickolov
> > > Microsoft MVP [VC], MCSD
> > > email: agnickolov@mvps.org
> > > MVP VC FAQ: http://www.mvps.org/vcfaq
> > > =====================================
> > >
> > > "DavidB" <davidb3@Ihatespam.hurkle.com> wrote in message
> > > news:4vJQc.36112$K53.4208@news-server.bigpond.net.au...
> > > > When implementing an event sink (say IAppEvents) in a client, it
seems
> > > that
> > > > the server may (or may not) QI the sink for the IID (eg
> IID_IAppEvents).
> > > >
> > > > Most servers I have tested just QI for IDispatch. That works just
> fine.
> > > This
> > > > seems correct, since Advise() is only required to provide an
> > > implementation
> > > > of IDispatch, not something inheriting from it.
> > > >
> > > > A server I built with ATL QI's for IAppEvents, and won't connect
> unless
> > > it's
> > > > found. Is this correct?
> > > >
> > > > It's pretty scary to say you implement an interface when you don't
> know
> > > what
> > > > you're going to be asked to do! What if it's dual?
> > > >
> > > > DavidB
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: david hurkle: "MSFlexGrid in simple ATL container window doesn't accept keystrokes"
- Previous message: david hurkle: "Re: ATL generates bad code for Firing events with [out] arguments"
- In reply to: Alexander Nickolov: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Next in thread: Igor Tandetnik: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Reply: Igor Tandetnik: "Re: Does an event sink need to support QI on the implemented interface, or just IDispatch?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|