0

Microsoft's documentation states that Asynchronous support is not available for IDispatch or for interfaces that inherit IDispatch ...but I want to do exactly that (to call Excel asynchronously from C++ as part of pywin32 if that's relevant). Where does this limitation come from? Are there any workarounds that don't involve a pool of threads making synchronous calls?

Nicholas White
  • 2,702
  • 3
  • 24
  • 28
  • Asynchronous COM interface are not that frequent. And I don't think its preventing you from using pywin32 or thread pools. Not sure what's your real problem is. – Simon Mourier Jun 01 '20 at 06:43
  • @SimonMourier I want to extend `pywin32` so it works with Python's built-in async functionality. While I can do this with a threadpool in the background, that adds a lot of overhead / bookkeeping as you have to marshal the objects to the threadpool thread before blocking synchronously (due to COM same-thread rules). – Nicholas White Jun 02 '20 at 20:38
  • I don't know the python side, but I don't think you can generalize "async" on the COM side. ISynchronize is rarely used (in fact, I don't know where it is, it's more a proposed mechanism if you want to write an async-able object). Instead, it's usually done in a non-standard way, two random Microsoft examples: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-irunnabletask or https://learn.microsoft.com/en-us/windows/win32/wpd_sdk/invoking-methods-asynchronously So, adding ISynchronize support in pywin32 seems useless, IMHO – Simon Mourier Jun 03 '20 at 07:07

0 Answers0