Exporting events from Python COM class.

Alex Martelli aleaxit at yahoo.com
Sat Nov 11 17:15:04 CET 2000


"Syver Enstad" <syver.enstad at sensewave.com> wrote in message
news:8ujku8$seu$1 at troll.powertech.no...
>
> "Alex Martelli" <aleaxit at yahoo.com> wrote in message
> news:8ujetu01u8b at news1.newsguy.com...
>
> > A single C++ object cannot implement two _fully separate_ "IDispatch
> > interfaces".
>
> Oh yes they can, I've done it myself, you just make two classes that
inherit
> IDispatch that delegate to another function. You just inherit from the two
> classes and implement the methods they call and you got two
implementations
> of IDispatch in one class.

Yes, the two sub-objects you're inheriting in your "single C++ object"
are each implementing a "fully separate IDispatch interface"; the "single
object" in question is implementing _neither_, though (don't believe
me...? just try a dynamic_cast<IDispatch*> of a pointer to that single
object... [compiling to C++ compliance, of course, i.e., using RTTI]).

In other words, it's the "usual renaming trick" which I alluded to in the
post you were answering (and more fully explored in the other recent
article in the Java/interface thread, which I mentioned in the latest
post -- not so much in a C++ context, though).

Still, it's correct that, with the good old renaming-trick, you can
use COM_INTERFACE_ENTRY2 rather than other macro variants of
COM_INTERFACE_ENTRY... [in ATL], and thereby possibly save
a few machine cycles!-)

(It's of course still the case that an object with a single COM
identity must only expose _one_ IID_IDispatch when QI'd for
it, but that's an orthogonal issue to C++ object identity ones).


> P.S. Are there any forums/newsgroups/sites for Microsoft technologies that
> have anything close to the signal/noise ratio on this group? The only site
I
> can think of is http://www.codeproject.com, do you know of any others?

CodeGuru (http://codeguru.earthweb.com/) has the "discussion
boards", which aren't bad for what they cover -- but the granularity
is all wrong... *176750* posts in "Visual C++ Programming"!-)

it.comp.programmare.win32 wasn't bad either back when I spent
my time there -- but it was, and remains, in Italian:-).


Alex






More information about the Python-list mailing list