Drawing an active-looking caption even when not active

Raymond Chen

“Why would somebody ever want to do that?” you might ask. Well, this is a common appearance for floating toolbars. (But aside from that case, I can’t think of any other valid reason to draw a window as active even though it isn’t.)

Fortunately this is easy to do. Just add this line to the WndProc of our scratch program:

    case WM_NCACTIVATE: if (wParam == FALSE) wParam = TRUE; break;

This says, “If Windows asks me to paint my caption bar in the inactive state, turn around and draw it in the active state.”


Discussion is closed.

Feedback usabilla icon