title: PrintWindow() WebBrowser returns a black image
body: <p>I'm making an application which would open flash game in WebBrowser and scan for pixels, so I'm trying to capture an image which I would scan after. This application would run in background (not minimized) so I cannot use standard screenshot capture, that is why I used PrintWindow function which captures certain area. I got MacromediaFlashPlayerActiveX HWND using EnumWindows and tried to print it's region. Although code below is from Delphi, I used the same PrintWindow on C# and I got black image too, so it is something to do with PrintWindow function. Tried webBrowser.DrawToBitmap too - still black image...</p>
  
  <pre><code>function PrintWindow(HWND:HWND;hdcBlt:HDC;nFlags:DWORD):BOOL; stdcall; external 'user32.dll'
  
  function zPrintWindow(hHWND: HWND; Bmp: TBitmap): Boolean;
  var
    r: TRect;
  begin
    result := False;
    GetWindowRect(hHWND, r) ;
    bmp.Width := r.Right - r.Left;
    bmp.Height := r.Bottom - r.Top;
    bmp.PixelFormat:=pf24bit;
    result := PrintWindow(hHWND, Bmp.Canvas.Handle, 0) ;
  end;
  
  procedure TForm1.Button2Click(Sender: TObject);
  begin
    zPrintWindow(StrToInt(Edit1.Text), Image1.Picture.Bitmap);
    Image1.Refresh;
  end;
  </code></pre>
  
  <p>The game I'm trying to capture screens is Wartune, but when captured, it gives black images. When tried other games, I get correct image. I also captured full form with various methods, including PrintWindow, but still - WebBrowser was in black. Why is this happening? Could it be because the game is high definition?</p>
  
  <p>Here is picture of black screen with PrintWindow. <a href="http://i.imgur.com/0V7mxbB.jpg" rel="nofollow">http://i.imgur.com/0V7mxbB.jpg</a>
  Here is picture how should it look (Captured with Alt+PrintScreen). <a href="http://i.imgur.com/YxX0hkA.png" rel="nofollow">http://i.imgur.com/YxX0hkA.png</a>
  Here is picture of other game which is captured okay with PrintWindow. <a href="http://i.imgur.com/NcWyMOe.jpg" rel="nofollow">http://i.imgur.com/NcWyMOe.jpg</a></p>