求助:主窗口的OnSize()中用子窗口的指针调用MoveWindow(),子窗口的OnSize()没有响应

陆人葭 2016-11-24 04:21:03
拖动主窗口时需要子窗口大小随之改变,但是在主窗口的OnSize()中用子窗口的指针调用MoveWindow()后,子窗口的OnSize()没有响应。查了一下微软官网上有人说是64位操作系统,当窗口嵌套过深时,MoveWindow()可能不会触发OnSize()。按上面说的解决方法改用OnWindowPosChanged()也只是部分窗口有效果。
请问有没有人遇到过这种情况?应该怎么解决?
...全文
382 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
worldy 2016-11-29
  • 打赏
  • 举报
回复
窗口嵌套,必须一层层传递
陆人葭 2016-11-29
  • 打赏
  • 举报
回复
引用 10 楼 VisualEleven 的回复:
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.
好的,谢谢,我看看有没有这种情况。
Eleven 2016-11-29
  • 打赏
  • 举报
回复
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.
陆人葭 2016-11-28
  • 打赏
  • 举报
回复
引用 7 楼 worldy 的回复:
拖动主窗口并没有OnSize,当然没有反应,你应该重写CWnd::OnWindowPosChanged
描述的不太清楚,是拖动窗口右下角改变大小。
worldy 2016-11-28
  • 打赏
  • 举报
回复
拖动主窗口并没有OnSize,当然没有反应,你应该重写CWnd::OnWindowPosChanged
陆人葭 2016-11-26
  • 打赏
  • 举报
回复
引用 4 楼 zhao4zhong1 的回复:
学会使用Spy++
1、 Hi, 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 incorrect). Any documentations about the limits of nesting windows? Or workaround for the above problems? Thanks, Manu 2、 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. Thanks again, Rich 这是我google到的两条相关信息
陆人葭 2016-11-26
  • 打赏
  • 举报
回复
引用 4 楼 zhao4zhong1 的回复:
学会使用Spy++
一直在用,确实是收不到WM_SIZE消息
陆人葭 2016-11-25
  • 打赏
  • 举报
回复
没人遇到过这种情况吗?现在的解决办法是在MoveWindow()的同时发送WM_SIZE消息
赵4老师 2016-11-25
  • 打赏
  • 举报
回复
学会使用Spy++
陆人葭 2016-11-24
  • 打赏
  • 举报
回复
引用 1 楼 shiyanzi 的回复:
用easysize试试,
根本就收不到WM_SIZE消息
  • 打赏
  • 举报
回复
用easysize试试,

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧