I'm trying to draw something in the title bar area to represent an X since there is no WS_CAPTION
, it just uses WS_EX_TOOLWINDOW | WS_EX_TOPMOST
and WS_POPUP|WS_THICKFRAME
. But I can't get anything to draw anywhere. I did a test below to just fill it all in red, but nothing changed. What am I doing wrong or missing?
case WM_NCACTIVATE:
case WM_NCPAINT:
{
// call default handler (I've tried it both ways, with and without DefWindowProc)
::DefWindowProc(hwnd, umsg, wparam, lparam);
HDC hdc;
if ((hdc=::GetWindowDC(hwnd))!=NULL) {
// Paint into this DC
RECT rcwin;
if (::GetWindowRect(hwnd, &rcwin)) {
HBRUSH hbrush=::CreateSolidBrush(RGB(255, 0, 0));
if (hbrush) {
rcwin.right-=rcwin.left;
rcwin.bottom-=rcwin.top;
rcwin.left=rcwin.top=0;
::FillRect(hdc, &rcwin, hbrush);
::DeleteObject(hbrush);
}
}
::ReleaseDC(hwnd, hdc);
}
return 0;
}