尝试将 MDI 子窗口提取到其 MDI 父窗口之外
我已经能够使用以下代码将 mdichild 窗口重新设置为桌面的父级:
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);
但是,一旦我尝试调整前子窗口的大小,整个应用程序就会崩溃。我想这是因为 exchild 不再收到消息了。我的问题是:如果我以某种方式创建一个不可见的 mdichild 将其消息转发给 exchild,我是否能够完成这项工作?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,那不健康。按照与 Windows 窗体相同的方式进行操作,只需重新创建窗口,现在减去 WS_EX_MDICHILD 样式标志。毁掉旧的。是的,你会看到一点闪烁。只需为这个新窗口提供相同的窗口过程即可利用现有代码。
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.