Hello MS-Office Experts,
I am developing a COM-based OneNote 2013 add-in in c#. As part of the add-in, modal winforms are to be shown. Normally, one would do this along the lines of
OneNote.Window context = control.Context as OneNote.Window; CWin32WindowWrapper owner = new CWin32WindowWrapper((IntPtr)context.WindowHandle); MyForm form = new MyForm(); form.ShowDialog(owner);
However, OneNote requires the add-in to be executed inside the DLLSurrogate/dllhost process. This collides with the desired modality of the winform as modality across process boundaries is not meant to be. As a consequence many minor and major issues arise:
+ the winform does not flash when clicking on OneNote (the supposed owner of the winform)
+ the winform looses focus when clicking on OneNote. However, OneNote is still being blocked
+ the add-in hangs when touching OneNote (i.e. touching the multi-touch monitor where OneNote is visible)
Any idea what to do?
I figure that the root cause of the problem is the process boundary. Is it possible to create a custom surrogate that runs inside the OneNote process? Would that solve the problem?
Thank you for your time an effort
Best