最小化或恢复时没有 WM_SIZE 消息

发布于 2024-09-24 20:56:54 字数 407 浏览 1 评论 0原文

根据MSDN,当窗口最小化或恢复时,应该将WM_SIZE发送到窗口。 但是我的应用程序窗口,即 WTL CDialogImpl 在最小化或恢复时永远不会获得 WM_SIZE 。

我使用spy++来检查它,我可以得到WM_SYSCOMMAND,WM_WINDOWPOSCHANING,WM_ACTIVE,WM_ACTIVEAPP等,但没有WM_SIZE。

我检查了一些其他 WTL 示例应用程序,在最小化或恢复时我能够获取 WM_SIZE 消息。

我的问题是为什么我的 WTL CDialogImpl 窗口没有收到 WM_SIZE? 除此之外,还有其他消息表明恢复或最小化完成吗? 我的意思是,在系统中,大多数时候,都有动画来显示最小化/恢复过程。我需要一条消息或事件来让应用程序知道恢复时动画已完成。

谢谢!

威廉·L.

According to MSDN, WM_SIZE should be sent to window when window is minimized or restored.
But my application window, which is WTL CDialogImpl never get WM_SIZE when minimize or restore.

I use spy++ to check on it, I can get WM_SYSCOMMAND, WM_WINDOWPOSCHANING, WM_ACTIVE, WM_ACTIVEAPP etc, but no WM_SIZE.

I checked some other WTL example application, I'm able to get WM_SIZE msg when minimize or restore.

My question is why my WTL CDialogImpl window doesn't receive WM_SIZE?
Besides this, is there any other message to indicate the restore or minimize finish?
I mean, in system, most of time, there is animation to show the minimize/restore process. I need a message or event to let app know the animation is done when restore.

thanks!

William L.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄想挽回 2024-10-01 20:56:54

doc 窗口通过其 WindowProc 函数接收此消息,因此您不会通过 Spy++ 获取它。

无论如何,在创建、最小化和恢复时,WM_SIZE 消息是在 ATL::CDialogImpl 派生对话框中接收的。

要使用 WTL AppWizard 检查它,请创建一个最小的 WTL 模态对话框应用程序,并为 WM_SIZE 添加消息映射条目和匹配的 OnSize() 成员:

    BEGIN_MSG_MAP(CMainDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        MESSAGE_HANDLER(WM_SIZE, OnSize)
        //...
    END_MSG_MAP()
    LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    {
        return 0;
    }

在 OnSize() 中设置一个断点,它将被命中。

您的问题(如果有)在其他地方。

As stated in the doc A window receives this message through its WindowProc function so you will not get it through Spy++.

Anyhow the WM_SIZE message is received in a ATL::CDialogImpl derived dialogs at creation, minimization and restoration.

To check it with the WTL AppWizard create a minimal WTL modal Dialog application and add a message map entry for WM_SIZE and a matching OnSize() member:

    BEGIN_MSG_MAP(CMainDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        MESSAGE_HANDLER(WM_SIZE, OnSize)
        //...
    END_MSG_MAP()
    LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    {
        return 0;
    }

Set a breakpoint in OnSize() it will be hit.

Your problem (if any) is elsewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文