I'm trying to implement Manipulating the zone identifier to specify where a file was download from – The Old New Thing - MSDN blogs in Python.
This doesn't really matter though, I only use Python code to demonstrate the symptoms (thus no python tag). Scroll down to a horizontal line and a header for the root problem and question if you wish.
TypeError: There is no interface object registered that supports this IID
There's nothing wrong with
IZoneIdentifier. The original C++ program runs just fine. As @IgorTandetnik pointed out, not every interface an object implements is going to be registered in the registry, only those that support marshalling.
The error comes from
pythoncom itself (a hint is that it's a
pythoncom.com_error, and the error message is always in English rather than the system's UI language).
The cause is that
pythoncom indeed requires
IDispatch support by the interface - or it wouldn't be able to deduce how to work with the interface's functions and values they accept/return.
The only exception is a number of
IUnknown-based interfaces support for which is compiled in (
IPersistFile is one of them; the full list is in
Support for other
IUnknown-based interfaces can be added with a "pythoncom extension" module. Some (very scarce) documentation on them can be found in
pywin32 docs in the Python and COM - Implementation Details article.