title: Window screenshot using WinAPI
body: <p>How to make a screenshot of program window using WinAPI &amp; C#?</p>
  
  <p>I sending <code>WM_PAINT (0x000F)</code> message to window, which I want to screenshot, <code>wParam = HDC</code>handle, but no screenshot in my picturebox. If I send a <code>WM_CLOSE</code> message, all waorking (target window closes). What I do wrong with <code>WM_PAINT</code>? May be HDC is not PictureBox (WinForms) component? P.S. <code>GetLastError() == ""</code></p>
  
  <pre><code>[DllImport("User32.dll")]
  public static extern Int64 SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    .....
  
  SendMessage(targetWindowHandle, 0x000F, pictureBox.Handle, IntPtr.Zero);
  </code></pre>