Disclaimer: I'm not familiar with the Win32 API, especially how windows work.
I'd like to make the window of some process a child window of another process. The two processes are also parent and child. But I don't think that matters. So far, everything works like a charm - Until I freeze the main thread of the child window.
Imagine a container.exe that 'hosts' notepad.exe and someApplication.exe
When I suspend the main thread of someApplication.exe for a few seconds, its window is frozen for that amount of time. That's perfectly understandable. But the window of container.exe will also hang for the same time. The child windows of other hosted processes (like notepad.exe) will continue to work fine.
I am using the SetParent
command to make a regular non-child window a child of my container.exe:
SetParent(
childProcess.HWND,
myOwnHWND
);
After that, I'm using setWindowPos
:
SetWindowPos(
childProcess.HWND,
HWND_TOP,
someXPos,
someYPos,
0,
0,
SWP_FRAMECHANGED or SWP_NOSIZE or SWP_SHOWWINDOW
)
As the MSDN article on SetParent suggests, I also clear the WS_POPUP
style attribute and add a WS_CHILD
attribute. Since that didn't help either, I also added a WS_EX_NOACTIVATE
extended style attribute, both by using the SetWindowLongPtr
command. Finally, I tried sending both windows a WM_UPDATEUISTATE
and then a WM_CHANGEUISTATE
message but that also didn't change a thing.
The thing that confuses me is that the window of the parent process continues to be drawn normally, until I touch it. Then it freezes completely until the child window unfreezes. I suspect something called an 'input queue'. The MSDN article about a WM_ACTIVATE
message states:
Sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately.
Because of that, I had high hopes for the WS_EX_NOACTIVATE
extended style attribute.
To sum it up: Is actually possible to host the window of another process and to not freeze your own window when the child window freezes?