title: Win32: My Application freezes while the user resizes the window
body: <p>I write a win32 application. I implemented the message loop myself like this:</p>
  
  <pre><code>     bool programcontinue = true;
       while(programcontinue)
       {
                while (PeekMessage(&amp;Msg, NULL, 0, 0, PM_REMOVE))
                {
                         TranslateMessage(&amp;Msg);
                         DispatchMessage(&amp;Msg);
                }
  
                IdleProcess();
       }
  </code></pre>
  
  <p>There is a resizable window in my application. Usually, IdleProcess() gets called several times per second. When the user grabs a corner or an edge of the resizable window, IdleProcess() doesn't get called anymore until the user releases the mouse button.</p>
  
  <p>What happens here?</p>
  
  <p>I tried exchanging the inner while with an if, but that doesn't change the behaviour. It seems like when resizing starts, the handler for that message does not return until the resizing is done?</p>
  
  <p>Is there a way to change this and call IdleProcess() during resizing a few times per second?</p>
  
  <p>Thanks
     Marc</p>
  
  <p>EDIT:</p>
  
  <p>What I mean by replacing the inner while with if is:</p>
  
  <pre><code> bool programcontinue = true;
   while(programcontinue)
   {
            if (PeekMessage(&amp;Msg, NULL, 0, 0, PM_REMOVE))  // &lt;&lt;&lt;&lt;
            {
                     TranslateMessage(&amp;Msg);
                     DispatchMessage(&amp;Msg);
            }
  
            IdleProcess();
   }
  </code></pre>
  
  <p>My window Proc is a bit lengthy, but I get the same behavior with a small test app. This is identical to the wndproc the VS Project Wizard creates:</p>
  
  <pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      int wmId, wmEvent;
      PAINTSTRUCT ps;
      HDC hdc;
  
      switch (message)
      {
      case WM_COMMAND:
          wmId    = LOWORD(wParam);
          wmEvent = HIWORD(wParam);
          // Parse the menu selections:
          switch (wmId)
          {
          case IDM_ABOUT:
              DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
              break;
          case IDM_EXIT:
              DestroyWindow(hWnd);
              break;
          default:
              return DefWindowProc(hWnd, message, wParam, lParam);
          }
          break;
      case WM_PAINT:
          hdc = BeginPaint(hWnd, &amp;ps);
          // TODO: Add any drawing code here...
          EndPaint(hWnd, &amp;ps);
          break;
      case WM_DESTROY:
          PostQuitMessage(0);
          break;
      default:
          return DefWindowProc(hWnd, message, wParam, lParam);
      }
      return 0;
  }
  </code></pre>