Windows什么时候删除message queue里面的消息?
是在wndproc开始呢?还是结束的时候呢?

解决方案 »

  1.   

    多长时间处理一个wm_paint消息就多长时间发送一个wm_paint消息
      

  2.   

    那么你的意思是wmpaint处理完以后windows再发了?
    那么wndproc在处理wmpaint消息的时候,message queue里面还有没有wmpaint消息?
    什么时候删掉这个消息的?
      

  3.   

    需要重画时发送wm_paint消息,
    beginpaint时删除
      

  4.   

    应该是收到第一个WM_PAINT之后他一直发送我们我们我们WM_PAINT,因为你没有把无效区域置为有效,因此又发送WM_PAINT,一直不断,你可以用Spy++看看...
      

  5.   

    还是不明白
    case WM_PAINT:
      return 0 ;                     //1如果在1处暂停,那么此时消息队列里面有没有wm_paint消息?
    如果1执行以后,此时消息队列里面有没有wm_paint消息?
      

  6.   

    因该只有一个wm_paint.这是一个低优先级的消息。没此针对wm_paint的处理好像只是更改了它们的优先级。
    你再看看:http://www.csdn.net/expert/topic/122/122281.shtm
      

  7.   

    当消息队列里面有WM_PAINT消息的时候,它会被合并,
    但是如果没有了,就会新添上一个,
    关键在于WM_PAINT消息是什么时候从消息队列里面被清除的?
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    如果是响应以后立刻就被清除的话,那么在WndProc处理过程中,会不会再加入新的WM_PAINT?
                                                         ~~~~~~~~~~~~~~~~~~~~~~~~
    Petzold说当窗口有效时,消息队列里面的WM_PAINT被清除,那么也就是BeginPaint函数的时候了,但是如果WndProc里面不调用BeginPaint函数,那么是否消息队列里面一直都有WM_PAINT消
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    息?
    ~~~
    有没有可能查看消息队列的内容?另外,消息队列是属于进程的,还是属于线程的?
      

  8.   

    这个问题很有意思,希望对Windows理解的比较深入的先生们能够解释一二?
      

  9.   

    有没有人看过programming windows?
      

  10.   

    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. 
      

  11.   

    2. 
    消息循环完成GetMessage()时,WMPAINT就被从应用程序队列中删除了。然后DispatchMessage()分发这个消息道你的WindowProc中3.
    系统自动向应用程序队列重反复重发WM_PAINT消息,如果:!!:应用程序中没有别的等待中消息的话。
      

  12.   

    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中被删除。
      

  13.   

    你说的这些都很好,
    不过对于你最后的修正,有人有不同的意见:
    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说的,不知道你的意见出自何处?
      

  14.   

    我一直以为message是GetMessage是清除的呢,原来WM_PAINT 与众不同
      

  15.   

    to vbhacker
    Petzold说的?唉,那就是他老人家对,我的错了。