Hi,

I have been using comtypes 0.6 dynamic dispatch support with the MSHTML 
interfaces in Internet Explorer and Outlook Express.

I have noticed that for some reason, comtypes is unable to find some 
properties, yet win32com can.

Specifically, using a text range object retreaved by 
IHTMLElement::createTextRange(), I can not access any properties that 
exist on the IHTMLTextRangeMetrics interface.

The text range object supports IHTMLTxtRange and IHTMLTextRangeMetrics, 
I'm not sure about any other interfaces.

I can access any property on the IHTMLTxtRange interface, but not 
IHTMLTextRangeMetrics.

I have found a temporary solution to the problem, and that is:
* In clude a comtypes.client.dynamic._Dispatch instance on the 
comtypes.client.lazybind.Dispatch instance, called something like 
'_dispatch'.
*inlazybind.Dispatch.__bind: catch NameError as well as 
comtypes.COMError when calling iTypeComp.bind.
*in lazybind.Dispatch.__getattr__: if a property can not be found with 
__bind (descr is None), then return getattr(self._dispatch,name). This 
will allow the name to be fetched using GetIDsOfNames etc.

This solution fixes the problem for me, and I can now access some more 
of the properties.

I have no idea why ITypeComp.bind cannot find the properties.

Interested if anyone has any idea why this might occure, or whether this 
solution is appropriate.

Thanks
Mick










------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to