1.The BeginPaint function automatically sets the clipping region of the device context to exclude any area outside the update region. The update region is set by the InvalidateRect or InvalidateRgn function and by the system after sizing, moving, creating, scrolling, or any other operation that affects the client area. If the update region is ed for erasing, BeginPaint sends a WM_ERASEBKGND message to the window. An application should not call BeginPaint except in response to a WM_PAINT message. Each call to BeginPaint must have a corresponding call to the EndPaint function. If the caret is in the area to be painted, BeginPaint automatically hides the caret to prevent it from being erased. If the window's class has a background brush, BeginPaint uses that brush to erase the background of the update region before returning.
4. 实际上,并不是真的反复在发送,而是GetMessage无消息可取时,就返回WM_PAINT消息!(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. )5. (FIX) 修正第二点,GetMessage时,WM_PAINT并不从队列中删除,也不是在BeginPaint中删除,而是在EndPaint中被删除。
你说的这些都很好, 不过对于你最后的修正,有人有不同的意见: After the window procedure calls BeginPaint during the WM_PAINT message,the entire client area is validated. ......If this call has the effect of validating the entire invalid area, then any WM_PAINT message currently in the queue is removed. 这句话是Petzold说的,不知道你的意见出自何处?
那么wndproc在处理wmpaint消息的时候,message queue里面还有没有wmpaint消息?
什么时候删掉这个消息的?
beginpaint时删除
case WM_PAINT:
return 0 ; //1如果在1处暂停,那么此时消息队列里面有没有wm_paint消息?
如果1执行以后,此时消息队列里面有没有wm_paint消息?
你再看看:http://www.csdn.net/expert/topic/122/122281.shtm
但是如果没有了,就会新添上一个,
关键在于WM_PAINT消息是什么时候从消息队列里面被清除的?
~~~~~~~~~~~~~~~~~~~~~~~~~~
如果是响应以后立刻就被清除的话,那么在WndProc处理过程中,会不会再加入新的WM_PAINT?
~~~~~~~~~~~~~~~~~~~~~~~~
Petzold说当窗口有效时,消息队列里面的WM_PAINT被清除,那么也就是BeginPaint函数的时候了,但是如果WndProc里面不调用BeginPaint函数,那么是否消息队列里面一直都有WM_PAINT消
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
息?
~~~
有没有可能查看消息队列的内容?另外,消息队列是属于进程的,还是属于线程的?
消息循环完成GetMessage()时,WMPAINT就被从应用程序队列中删除了。然后DispatchMessage()分发这个消息道你的WindowProc中3.
系统自动向应用程序队列重反复重发WM_PAINT消息,如果:!!:应用程序中没有别的等待中消息的话。
实际上,并不是真的反复在发送,而是GetMessage无消息可取时,就返回WM_PAINT消息!(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.
)5. (FIX)
修正第二点,GetMessage时,WM_PAINT并不从队列中删除,也不是在BeginPaint中删除,而是在EndPaint中被删除。
不过对于你最后的修正,有人有不同的意见:
After the window procedure calls BeginPaint during the WM_PAINT message,the entire client area is validated. ......If this call has the effect of validating the entire invalid area, then any WM_PAINT message currently in the queue is removed.
这句话是Petzold说的,不知道你的意见出自何处?
Petzold说的?唉,那就是他老人家对,我的错了。