enthought / enthought/comtypes
.NET COM events using IDispatch are not handled
- Dominant language
- Python
- Stars
- 345
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
In C#, as a guideline, events are exposed by an `IDispatch` interface for late-binding only, by using the attribute `[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]`.
It seems like there's no way to sink those events, a code like follows:
```
class IEvents():
def IEvents_OnResult(self, this, result):
print(f"Event! {result}")
from comtypes.client import GetEvents
sink = IEvents()
connection = GetEvents(obj, sink)
```
will cause the error `_ctypes.COMError: (-2147467263, 'Not implemented', ('The method or operation is not implemented.', 'mscorlib', None, 0, None))`
Is there a way to handle this use case?
Thanks
Contributor guide
Assessment
This issue has not been assessed yet.