I'm developing a multi-process framework for a complex application. A Host process acts as a container, and one or more guest processes can be spawn from it. A Window of such guest processes is reparented to a Hosts's window (such as a notebook tabSheet). (InterProcess Communication is not an issue here - it works) Imagine something similar to Google Chrome. I've read many answers about reparenting windows across processes, but I can't figure out what's happening in this case:
- My Host (container) process happens to be doing a
WaitForMultipleObjects
on some Handles; - A Guest Process invokes a
MessageBox
, but hangs.
Doesn't the guest process run on a separate message queue? What am I missing?
I think I followed the best guidelines about SetParent
when I embedded the Guest Form:
SetWindowLong(GuestHWnd, GWL_STYLE, GetWindowLong(GuestHWND, GWL_STYLE) and WS_EX_NOPARENTNOTIFY and (not WS_POPUP) or WS_CHILD);
SetParent(GuestHWnd, HostHWnd);
PostMessage(GuestHWnd, WM_UPDATEUISTATE, UIS_INITIALIZE, 0);
SendMessage(HostHWnd, WM_UPDATEUISTATE, UIS_INITIALIZE, 0);
SetWindowPos(GuestHWnd, 0, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER or SWP_FRAMECHANGED);
Notice also that I haven't called any sort of AttachThreadInput
.
The problem doesn't arise if the Host is not blocked, or if the Guest window is not a child of a host's (obviously).
Thank you.