title: WinAPI's ::WaitMessage stops WM_TIMER from coming
body: <p>I have encountered a, so it seems to me, strange behaviour of the WinAPI. In my program I am setting a timer for the window with</p>
  
  <pre><code>::SetTimer(window_handle, timer_id, 10, NULL);
  </code></pre>
  
  <p>and handle the WM_TIMER message in my window procedure. To reduce the amount of cpu time needed I am also using the <code>::WaitMessage</code> function in my message pump.
  Turns out now that, as long as I have the <code>::WaitMessage</code> function there, the WM_TIMER messages just stop coming after a while. If I remove it from my message pump everything works just fine as expected.</p>
  
  <p>Now I wonder wether I set up my timer wrong or if this is standard behaviour of <code>::WaitMessage</code>. Searching MSDN and the web did not give me an idea why this is like this.</p>
  
  <p>Here is the message pump I use:</p>
  
  <pre><code>while(true) {
      if(GetMessage(&amp;msg, _window_handle, 0, 0) &gt; 0) {
          TranslateMessage(&amp;msg);
          DispatchMessage(&amp;msg);
      } else { 
          return 0; 
      }
  
      WaitMessage();
  }
  </code></pre>
  
  <p>Hope that someone can clear this up for me.</p>