Mixing the RDW_NOERASE and RDW_INVALIDATE flags of RedrawWindow()

In this previous thread: http://www.cplusplus.com/forum/windows/107905/, I found the following code:

1
2
3
4
    // redraw the portion of the window that was just painted over with the rotating star,
    // but specify RDW_NOERASE to keep the desktop from drawing the background as well
    RECT rc = {posX-50, posY-50, posX+50, posY+50};
    RedrawWindow( hWnd, &rc, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW );


I think that this code is incorrect, because I think that the RDW_NOERASE and RDW_INVALIDATE flags cannot be mixed, am I right?
am I right?

No.
What makes you think that they can be mixed? the RedrawWindow() documentation separates the flags into two groups:

The following flags are used to invalidate the window: RDW_ERASE, RDW_FRAME, RDW_INTERNALPAINT, RDW_INVALIDATE.

The following flags are used to validate the window: RDW_NOERASE, RDW_NOFRAME, RDW_NOINTERNALPAINT, RDW_VALIDATE.
What makes you think that they can be mixed?

The documentation.

No other flags are required for RDW_NOERASE to be valid. The fact that they are grouped in the documentation separately doesn't have anything to do with whether the flags may be mixed.
So if I want my window to only receive a WM_PAINT message without the WM_ERASEBKGND message, I would do this:

RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOERASE | RDW_NOCHILDREN);

instead of this:

RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);

correct?
Topic archived. No new replies allowed.