Vincent Lindgren
Vincent Lindgren

Reputation: 13

Constraining draggable child windows within parent window?

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?

Upvotes: 1

Views: 531

Answers (2)

David Heffernan
David Heffernan

Reputation: 612854

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.

Upvotes: 3

Frankie_C
Frankie_C

Reputation: 4877

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.

Upvotes: 1

Related Questions