tags:

views:

17

answers:

1

I have been able to reparent an mdichild window to the desktop with the following code:

SetParent(hSeekedWindow,0);
SetWindowLong(hSeekedWindow,GWL_STYLE,WS_OVERLAPPED|WS_VISIBLE|WS_CAPTION|WS_MAXIMIZEBOX|    WS_MINIMIZEBOX|WS_THICKFRAME|WS_SIZEBOX);
SetWindowLong(hSeekedWindow,GWL_EXSTYLE,WS_EX_CLIENTEDGE);

However, as soon as i try to resize the ex-childwindow the whole app crashes. I suppose this is because the exchild is not getting its messages anymore. My question is this: would i be able to make this work if i somehow created an invisible mdichild that forwards its messages to exchild?

+1  A: 

Yeah, that's not healthy. Do it the same way as Windows Forms does it, just re-create the window, now minus the WS_EX_MDICHILD style flag. Destroy the old one. Yes, you'll get a bit of flicker. Leverage your existing code simply by giving this new window the same window procedure.

Hans Passant