[python-win32] extending com objects

Ross McKerchar it at crummock.com
Mon Dec 18 14:37:52 CET 2006


Could somebody please confirm that my objectives below are neither 1) 
Reinventing the wheel or 2) Attempting something that has deliberately 
_not_ been done by someone far wiser than me.

Put simply I want to extend a com object, which, if I understand 
correctly is not possible in the "normal" [i.e. class Square(Shape):] way.

To do this my aim was to implement something akin to a simpler & more 
generic version of Tim Golden's wmi stuff (which I find amazingly useful 
- thanks!). Specifically: create a class to transparently wrap a generic 
com object, so that, if the wrapper class didn't have a method or an 
attribute I would catch the error and try calling the same 
method/attribute on the object I was wrapping (using some getattr & 
setattr black magic).

Should I get coding or am I missing something?

thanks,

-ross



More information about the Python-win32 mailing list