Tobias Kienzler Tobias Kienzler - 1 year ago 112
Python Question

What does _com_interfaces_ do?

I'm trying to understand the COM server examples of , and in

I saw the line

_com_interfaces_ = [shell.IID_IExtractIcon, pythoncom.IID_IPersistFile]

While that pretty clearly refers to an
having to implement the
interfaces, I cannot find any documentation where
is actually used. It is nowhere to be seen in
, so neither registration nor the server call seem to actually use this. Is there any documentation on

Answer Source

_com_interfaces_ is an optional attribute a Server Policy looks for:


Optional list of IIDs exposed by this object. If this attribute is missing, IID_IDispatch is assumed (ie, if not supplied, the COM object will be created as a normal Automation object.

The list is used to answer QueryInterface inqueries, see the win32com.server.policy module to see how this is being used, specifically the BasicPolicy._wrap() and BasicPolicy._QueryInterface_ methods.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download