Redefining a non-client area is always fraught with danger. Window manager seems to make a lot of assumptions for optimization. Clearly this can be done, see Office, but it can take a lot of experimentation.
Just an idea. Call RedrawWindow twice, once, to invalidate the non-client area, and then check the client area again.
RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); RedrawWidnow(hwnd, NULL, NULL, RDW_NOFRAME | RDW_VALIDATE);
Another idea is to try to draw a frame right away without making anything invalid:
RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
Another idea is to specify an empty RECT or HREGION in the 2nd or 3rd parameters. This may not invalidate the client area this way.
source share