Events in win32com

Mark Hammond MarkH at ActiveState.com
Thu Dec 21 21:57:50 EST 2000


Alex Martelli wrote:

> Yes, but -- how does this play with the bForDemand flag, which
> is really a must when the module is as huge as MSHTML...?

Hrm.  Good question.

> Sure, once I managed to somehow grab the right module it's very
> easy; but I think I've not yet grasped how to do that grabbing
> in the current 'bForDemand' architecture (indispensable for
> really huge type libraries, of course).  For example, consider
> the following attempt:

with bForDemand, there are 2 distinct steps - getting the module and 
getting the class.  You are correct that the code I outlined wont work 
there.

The module is _always_ created at makepy time, and references to all 
subordinate items created at that time.

> But how do I instantiate and call genpy.Generator, or arrange for
> it to be instantiated and called, to ensure the HTMLDocumentEvents2.py
> gets built in the bForDemand setting...?  Is there a canonical/
> recommended way...?

gencache.GetClassForProgID() and GetClassForCLSIDID - however, the 
"EnsureModule" will already need to have been run.  There is no 
single-step generate-module-for-demand-and-get-a-specific-class.

I would be more than happy for us to step back and look at the 
makepy/gencache exposed API - I agree it sucks, as it "just grew" and 
was really never designed for direct use by client code - it just 
happened that way.

I would be happy for discussion either here, or on the Python COM 
developers list at 
http://mailman.pythonpros.com/mailman/listinfo/pycom-dev - that is very 
quiet tho - not much COM work is going on at the moment.

Mark.




More information about the Python-list mailing list