1

Please take a look at this screenshot:

enter image description here

As you can see, the "Executable modules" and "Threads" child windows are free to roam about in the sandbox-like "Themida" parent window, and if they get dragged past the edge the overflow simply gets hidden. How can I create this effect?

2 Answers2

3

That is a Multiple Document Interface (MDI) application. The containing window, with the dark grey background is the MDI client window, and the windows inside are the MDI child windows.

The use of MDI has been discouraged by Microsoft for many years so you may wish to think twice about using it in a new application.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Is there any way for me to achieve a (visually or functionally) similar effect? I'm writing an app that embeds a game window into my own window as a child, and then provides all sorts of tools to interact with it. I was going to have each "tool" and the game window itself be an MDI child window. – Vincent Lindgren Aug 23 '15 at 19:56
  • 1
    @VincentLindgren The underlying technology still works so there's nothing stopping you using MDI, it's just advised not to use that sort of interface any more. – Jonathan Potter Aug 23 '15 at 19:58
  • MDI has not been deprecated by Microsoft. Microsoft recommends against using it, based on usability considerations, but not due to deprecation (see [Multiple Document Interface](https://msdn.microsoft.com/en-us/library/windows/desktop/ms632591.aspx): *"Many new and intermediate users find it difficult to learn to use MDI applications. Therefore, you should consider other models for your user interface. **However, you can use MDI for applications which do not easily fit into an existing model.**"*). – IInspectable Aug 23 '15 at 22:14
1

Simply set the window style to WS_CHILD, and the window will be confined in the parent client rectangle.

You can do this during window creation, or after using SetWindowLongPtr() and GetWindowLongPtr():

 SetWindowLongPtr(hwnd, GWL_STYLE, WS_CHILD | GetWindowLongPtr(hwnd, GWL_STYLE));

P.S. You don't need to create an MDI application to have this behavior.

Frankie_C
  • 4,764
  • 1
  • 13
  • 30