title: PrintWindow send message WM_PAINT or WM_PRINT?
body: <p>According to msdn <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd162869(v=vs.85).aspx" rel="nofollow noreferrer">PrintWindow</a> (retrieved date May 5th 2017)</p>
  <blockquote>
  <p>The application that owns the window referenced by hWnd processes the PrintWindow call and renders the image in the device context that is referenced by hdcBlt. The application receives a WM_PRINT message or, if the PW_PRINTCLIENT flag is specified, a WM_PRINTCLIENT message. For more information, see WM_PRINT and WM_PRINTCLIENT.</p>
  </blockquote>
  <p>MSDN never claim about the message WM_PAINT.
  But what I have tested prove the claim above about the WM_PRINT message wrong.</p>
  <p>App A:</p>
  <pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch (message)
      {
      case WM_PAINT:
          DefWindowProc(hWnd, message, wParam, lParam);
          break;
      case WM_PRINT:
          OutputDebugStringA(&quot;WM_PRINT&quot;);
          break;
      case WM_PRINTCLIENT:
          OutputDebugStringA(&quot;WM_PRINTCLIENT&quot;);
          break;
      //other cases ...
      }
      return 0;
  }
  </code></pre>
  <p>App B (more details about <a href="https://stackoverflow.com/a/7292773/4608491">App B</a>)</p>
  <pre><code>HWND hwnd = FindWindow(NULL, lpString);
  //...
  //PrintWindow(hwnd, hdc, PW_CLIENTONLY);
  PrintWindow(hwnd, hdc, 0);
   
  </code></pre>
  <p>When I call the App B to capture the App A. According to msdn PrintWindow, case WM_PRINT should hit, but instead, case WM_PAINT is hit.</p>
  <p>According to <a href="http://social.msdn.microsoft.com/forums/en-US/winforms/thread/d9a188ae-3503-4c31-aa00-6e7195b5384a" rel="nofollow noreferrer">this article</a></p>
  <blockquote>
  <p>If that's true then layered windows not implementing WM_PAINT can't be captured because UpdateWindow just sends WM_PAINT</p>
  </blockquote>
  <p>So at last, I just want to know if msdn is wrong or my code is wrong? PrintWindow send message WM_PAINT or WM_PRINT? If it does really send message WM_PRINT, how does message WM_PRINT works?</p>