Hosting WPF plugin cross-process issue
Asked Answered
V

1

2

I use an approach similar to http://www.codeproject.com/Articles/516431/Baktun-Shell-Hosting-WPF-Child-Windows-in-Another to host WPF applications (plugins) in another process via the AddInHost (derived from HwndHost) class.

This works fine so far as long as I don't suspend the child process. If I do so then also the parent process is frozen. The reason for this is that the parent/child processes are sharing the same (synchronous) Input Queue: Good or evil - SetParent() win32 API between different processes

I have already tried to decouple the two processes before I suspend the plugin process with the SetParent Win32 function but even the plugin is then decoupled from the host-application it does not help to get rid of the problem:

public static void Decouple(HwndHost hwndHost)
{
  SetParent(hwndHost.Handle, IntPtr.Zero);
}

Any ideas what I am missing here to separate the two processes so that they don't share the same input queue any longer?

Vieira answered 10/11, 2016 at 10:57 Comment(1)
The general problem is also good explained here: #16817612Vieira
V
1

For me the solution was to use AttachThreadInput Win32 API function to detach the plugin HwndHost input queue

Vieira answered 14/11, 2016 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.