title: PeekMessage() Resetting the Mouse Cursor
body: <p>Im currently messing around with changing the mouse cursor within a game like C++ application for Windows XP. </p>
  
  <p>To change the cursor I am using <code>SetCursor()</code> and passing in the desired cursor, which is working. However during the while loop in which <code>PeekMessage()</code> is called the cursor keep getting reset back to the default arrow.</p>
  
  <p>This is the offending loop:</p>
  
  <pre><code>MSG  msg;
  while( PeekMessage( &amp;msg, NULL, 0U, 0U, PM_REMOVE ) )
  {
      TranslateMessage( &amp;msg );
      DispatchMessage( &amp;msg );
  }
  </code></pre>
  
  <p>While debugging I found that the cursor changed during the call to <code>PeekMessage()</code> after which msg.message == 0x200, which should make the message one of these:</p>
  
  <pre><code>WM_MOUSEFIRST = 0x200
  WM_MOUSEMOVE = 0x200
  </code></pre>
  
  <p>I haven't been able to find any information on why this is happening, and have no experience with windows messages.</p>
  
  <p>Thanks.</p>
  
  <p><b>Edit:</b></p>
  
  <p>According to <a href="http://msdn.microsoft.com/en-us/library/ms648380(VS.85).aspx" rel="nofollow noreferrer">here</a> the system redraws the class cursor everytime the mouse moves, effectively setting it back to the default cursor. With this in mind i added this to the window message callback function: </p>
  
  <pre><code>case WM_SETCURSOR:
      return 0;
  </code></pre>
  
  <p>problem solved.</p>