title: WM_PAINT message is queued message or Nonqueued Messages?
body: <p>In this article <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644927%28v=vs.85%29.aspx" rel="nofollow noreferrer">About Messages and Message Queues</a>, it was said that WM_PAINT is kind of Queued Messages.</p>
  <p>Queued Messages</p>
  <blockquote>
  <p>Whenever the user moves the mouse, clicks the mouse buttons, or types
  on the keyboard, the device driver for the mouse or keyboard converts
  the input into messages and places them in the system message queue.
  The system removes the messages, one at a time, from the system
  message queue, examines them to determine the destination window, and
  then posts them to the message queue of the thread that created the
  destination window. A thread's message queue receives all mouse and
  keyboard messages for the windows created by the thread. The thread
  removes messages from its queue and directs the system to send them to
  the appropriate window procedure for processing.</p>
  <p>With the exception of the WM_PAINT message, the WM_TIMER message, and the WM_QUIT message,
  the system always posts messages at the end of a message queue. This
  ensures that a window receives its input messages in the proper first
  in, first out (FIFO) sequence. The WM_PAINT message, the WM_TIMER
  message, and the WM_QUIT message, however, are kept in the queue and
  are forwarded to the window procedure only when the queue contains no
  other messages. In addition, multiple WM_PAINT messages for the same
  window are combined into a single WM_PAINT message, consolidating all
  invalid parts of the client area into a single area. Combining
  WM_PAINT messages reduces the number of times a window must redraw the
  contents of its client area.</p>
  </blockquote>
  <p>But according to the book &quot;programming windows&quot;</p>
  <blockquote>
  <p>However, the window procedure could call a function that sends the
  window procedure another message, in which case the window procedure
  must finish processing the second message before the function call
  returns, at which time the window procedure proceeds with the original
  message. For example, when a window procedure calls UpdateWindow,
  Windows calls the window procedure with a WM_PAINT message. When the
  window procedure finishes processing the WM_PAINT message, the
  UpdateWindowcall will return controls back to the window procedure.</p>
  </blockquote>
  <p>If the WM_PAINT is queued message, it should be added to the message queue.
  so it will not process until current message and all the other messages in the message queue have been processed. which is controversy with the statement above.</p>
  <p>I am wondering which is correct, Thanks.</p>