What message is processed in the process of minimizing or maximizing the window?

I want to draw the window title bar with MFC myself. Therefore, I override the OnNcPaint () method of CMainFrame. Everything looks good until I clicked an item in the control menu to minimize it or maximize it. During the thumbnail or maximization process, I see that the original title bar has appeared. I do not know why this happened. Maybe there are some messages that I did not process in this process? Need your help. Many thanks!

+3
source share
4 answers

In the process of minimizing / maximizing? Sounds like a min / max animation. You can verify this by disabling the animation using My Computer> Properties> Advanced (Performance).

As for the title question, you will get WM_SIZE. Take a look at the docs for CWnd :: OnSize .

CMyDialog::OnSize(UINT nType, int cx, int cy)
{
    switch (nType)
    {
        case SIZE_MAXIMIZED:
            // window was maximized
            break;

        case SIZE_MINIMIZED:
            // window was minimized
            break;

        case SIZE_RESTORED:
            // misleading - this occurs when restored from minimized/maximized AND
            // for normal size operations when already restored
            break;

        default:
            // you could also deal with SIZE_MAXHIDE and SIZE_MAXSHOW
            // but rarely need to
            break;
    }
}
+2
source

You can use Spy ++ to find out what messages the window received. My vague OnSize memories come earlier than some of the messages I was expecting.

0
source

OnShow . OnSize ..
, SW_MAXIMIZE SW_MINIMIZE..

, .
, , , . , , , .

0

, ? "" "" .

. DrawAnimatedRects API-, . .

, . , , Office. Windows, . , . , "" , , , ( ).

So, to answer your question, no message has been sent . Resizing animations are performed by the window manager without any help or involvement in window resizing. As for your program, the window goes directly from its original size to its new size.

0
source

All Articles