Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Handling WM_NCPAINT.

170 views
Skip to first unread message

johnny

unread,
Jul 22, 2002, 4:45:50 AM7/22/02
to
Dear All,

I want to draw a button in the menu bar. So I intercept the message
WM_NCPAINT and in the handler I do like the following.

void OnNcPaint()
{
Default();

CDC* pDC = GetWindowDC();
...;
pDC->Draw...
}

This way can work except that when the window is deactivated my own button
disappears. If I resize the window, the button shows again. So I comment
the line : Default(); Make it not call the default implementation. To my
supprise that the window's caption and menu bar can still be shown. I
had thought that windows draws the caption bar and menu bar in the handler
of WM_NCPAINT. But it seems that it doesn't. Why?

Regards,
Johnny.


johnny

unread,
Jul 22, 2002, 5:09:50 AM7/22/02
to
This problem is fixed.

On the handler of WM_NCACTIVATE, the default window proc will redraw
the non client area. But it draws the area by calling the internal function
directly I think, because sending message of WM_NCPAINT has no effect.

Johnny.

"johnny" <johnn...@witron.com.cn> wrote in message
news:OVqa1vVMCHA.388@tkmsftngp09...

ghl

unread,
Jul 22, 2002, 7:16:20 AM7/22/02
to
"johnny" <johnn...@witron.com.cn> wrote in message
news:ebJnN9VMCHA.944@tkmsftngp10...

See rather long article at
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0197/c++/c++0197.htm
&nav=/msj/0197/newnav.htm
that deals with this topic.
--
Gary


0 new messages