I found an issue where MoveWindow would not send a WM_SIZE message to the window
whose size I've requested to change.
To reproduce this, I've setup a window (level 0) with a child (level 1) which
has another child (level 2), and so on. When I resize `level 0', I get a WM_SIZE
message and I'm calling `MoveWindow' on child at level 1 to resize it, which
triggers a WM_SIZE message on child at level 1 and I call MoveWindow on child at
level 2 and so on.
It will stop sending the WM_SIZE message at a certain level. It fails on both 32
bits and 64 bits version of Windows, the only difference is that my experiments
show that with the 32 bits version it stops at level 32, and on 64 bits it stops
when the level is 16.
At the same time, I've checked how much nesting I could do and found that at
level 47, a call to `SetParent' will fail with error code 87 (Parameter being
Any documentations about the limits of nesting windows? Or workaround for the
My final solution was to modify the splitter class that I use to post a WM_SIZE message after calling MoveWindow. From the OnSize method of the splitter class, I pass along the nType parameter sent to OnSize. For all other moves (from mouse interaction, etc), I used SIZE_RESTORE as the nType for the WM_SIZE message.
The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.
我在响应<em>窗口</em>OnSize(UINT nType, int cx, int cy)函数时，想要改变里面控件的大小，但是我在设计控件时用的单位是DLU，好象与传进来的参数cx与cy的单位不一致，应该怎么处理呢?不知道能不能换算单位。rn我设置控件大小使用MoveWindow()，可能是由于单位不一致，没有出现想要的效果。rn，有没有代码可以参考一下。比如希望控件边界与整个<em>窗口</em>的客户区的边界保持一定距离。rn谢谢！
Form2 f2 = new Form2(this);//把Fo...