Ok... exactly how often do WM_PAINT messages get sent? I guess that's rhetorical because I just found out: in several of my apps I'm getting >1,000 calls to WM_PAINT per second.

I've never noticed this before, except in one app i have the whole client area redrawn and the client area was flickering like crazy with nothing going on. So I set up the counter which tells me 1,000 calls per second or so.

Does this seem strange to anybody?

--Chorus
Posted on 2002-08-23 18:58:26 by chorus
Certainly something to do with your code.
Posted on 2002-08-23 19:07:25 by comrade
Found the problem. It has to do with the way I get my DC. Since the class has CS_OWNDC I've been using

GetDCEx,hWin,NULL,DCX_VALIDATE or DCX_INTERSECTUPDATE

instead of BeginPaint/EndPaint (which, according to MSDN is a fair replacement). The thing is, I have to add

ValidateRect,hWin,NULL

to stop the thousands of repaints. I was of the understanding that DCX_VALIDATE did this. I guess not...

--Chorus
Posted on 2002-08-23 19:25:12 by chorus
According to the Win32 SDK Reference:

The system sends this message when there are no other messages in the application?s message queue. DispatchMessage determines where to send the message; GetMessage determines which message to dispatch. GetMessage returns the WM_PAINT message when there are no other messages in the application?s message queue, and DispatchMessage sends the message to the appropriate window procedure.
Posted on 2002-08-23 19:38:19 by Tomasz Grysztar