Displaying a window from one process in another process


In Windows programming, a window handle (HWND) can be created in one application, but accessed by other applications, and can even be added as a child in another process.

Is the same true on macOS, or Linux? Can a window created in one process be displayed in another process?

It would be more fair to say that one process can manage the window of another process (as if the first process were the window manager), displaying it over the content of a window it owns.

So, yes, it can be done. It is just a matter of managing the child process’s window.
(And, if you have access to the underlying window handle, then you can do stuff to it too, but the way it works in Linux is quite a bit different underneath. In X, you need access to the child’s Window.)

Different toolkits have different ways of managing this for you; most of them don’t make underlying Window access transparent, preferring to abstract it away from you.

Some toolkits have APIs designed to allow you to do exactly what you want, but off the top of my head I can’t name any. Perhaps Qt and Gnome, and maybe wxWidgets.

It would be easier to start the child process and simply send it geometry hints about where to reposition itself. But again, window managers vary, and there still exist quite a few that don’t obey properly.

tl;dr Lots of grief; spend time Googling "<toolkit name> reparent child process window", substituting your development GUI toolkit’s name.

Sorry and Good luck!
Topic archived. No new replies allowed.