How do I host an application window as a child of a window belonging to another process?

落爺英雄遲暮 提交于 2019-12-13 12:31:25

问题


I would like to host an application window from a process "A" into the main window of a process "B", just as if "A"'s window were a MDI child window. Is this possible in Windows? Or are there some tricks which would allow me to fake this?

By the way, I'd like to remove the title bar (or better yet, all the non-client stuff) of "A"'s window when it is embedded into "B"'s window. I suppose that this must be possible by tweaking the window styles or window classes, but I am by no means an expert in these Win32 intricacies.


回答1:


It's possible to host the Window. Change A's parent HWND by calling the SetParent function against it. To change the window styles, you need to use the GetWindowLong/SetWindowLong pair to change the attributes that you want to muck with.

If this is a third-party application (ie, not yours), then you're probably in for a rough ride, particularly if the window does any theming or anything custom with its window (for example, changes to the drag area, etc).



来源:https://stackoverflow.com/questions/522126/how-do-i-host-an-application-window-as-a-child-of-a-window-belonging-to-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!