How can you enable a window in an MDI application to leave it as the parent w / Win32 container?

I have an MDI application. I would like to add an icon to the non client title bar of the child window, which allows the window to float separately from the parent MDI container, allowing the user to accept child windows and arbitrarily place them around the desktop, outside the MDI window.

I saw how this was done, so I know that this is possible, but it’s hard for me to figure out how to do it.

I use WTL (Windows Template Library), but I mark it with MFC and Win32, because I think that the basic principles will be the same, and people can have knowledge across the entire spectrum of the Windows API.

+3
source share
1 answer

It has been a while since I did this, but I think it was enough to call SetParent (your_hwnd, 0) so that the window evades its parent.

The message transfer will change a bit, so you will have to redirect some messages from the main window to the previous child window. This is most likely necessary if you want the main menu of your MDI application to work with an ex-child.

If you are having problems drawing, you may need to change the style of the window using SetWindowLong .

A good choice for using WTL btw is in my oppinion a very nice abstraction of the API without any calls and whistles.

+4
source

Source: https://habr.com/ru/post/1705090/


All Articles