I've implemented a WindowProc in which I handle the WM_NCPAINT message, but I can't get the result I want. As I only want to add a colored rectangle the width of the window at the bottom of the title bar, I first let defWindowProc handle the message and then proceed to (try to) draw over that.
In my first attempt I got a dc from GetWindowDC. Although my code was executed, the result was not visible.
In my second attempt I got a dc by calling GetDCEx (I'm using a region created from the windowRect) and passing DCX_WINDOW | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE as the flags (without DCX_LOCKWINDOWUPDATE GetDCEx returns null). The visual result however, is the same as in my first attempt: completely invisible.
In both instances I've (temporarily) attempted to paint the entire frame red:
RECT windowRect;
::GetWindowRect( hwnd, & windowRect );
HBRUSH hbrush = ::CreateSolidBrush(RGB(255, 0, 0));
FillRect( hdc, &windowRect, hbrush );
::DeleteObject(hbrush);
::ReleaseDC(hwnd, hdc);
Can someone point me to what I'm doing wrong? Forgot to mention: I'm working in Windows 10.