You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET COM events using IDispatch are not handled #873
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))
COM event handling is consistently one of the more challenging areas for this project.
Moreover, dealing with event sinking through late-bind only interfaces adds significant complexity.
To help us investigate this issue further, would you be able to provide a minimal reproducer for the C# COM server and event you are using?
This would be extremely helpful for isolating and debugging the problem.
Hello,
here's a demo project with some notes and Python scripts that may help.
Please check FIXME tags.
You can register with regasm DemoCOM.dll /codebase /tlb after build, sorry
but binaries are not included because of email policies.
Regards
Il giorno dom 12 ott 2025 alle ore 07:56 Jun Komoda <
***@***.***> ha scritto:
Activity
junkmd commentedon Oct 12, 2025
COM event handling is consistently one of the more challenging areas for this project.
Moreover, dealing with event sinking through late-bind only interfaces adds significant complexity.
To help us investigate this issue further, would you be able to provide a minimal reproducer for the C# COM server and event you are using?
This would be extremely helpful for isolating and debugging the problem.
spynetcamera commentedon Oct 14, 2025
junkmd commentedon Oct 31, 2025
No file is attached.
Could you share the files on your public repository?
spynetcamera commentedon Nov 1, 2025
DemoCOM (NET Framework).zip
Here you go, I have attached to email and just realized it is not visible on GitHub.