问题
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?
回答1:
For me the solution was to use AttachThreadInput Win32 API function to detach the plugin HwndHost input queue
来源:https://stackoverflow.com/questions/40525884/hosting-wpf-plugin-cross-process-issue