title: Capturing MEmu emulator screen
body: <p>I'm trying to capture MEmu emulator screen using some win apis, but everything I tried I keep getting a black screen, the screenshot has the correct size, but it's all black.</p>
  
  <p>Here is some code I'm using now:</p>
  
  <pre><code>IntPtr hwnd = Process.GetProcessByName("Memu")[0].MainWindowHandle; //Gets the first process
  
  RECT2 rc;
  GetWindowRect(hwnd, out rc);
  
  Bitmap bmp = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
  Graphics gfxBmp = Graphics.FromImage(bmp);
  IntPtr hdcBitmap = gfxBmp.GetHdc();
  
  PrintWindow(hwnd, hdcBitmap, 1);
  
  gfxBmp.ReleaseHdc(hdcBitmap);
  gfxBmp.Dispose();
  
  bmp.Save("test.png");
  </code></pre>
  
  <p>And here is the output image:
  <a href="https://i.stack.imgur.com/nSTIb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nSTIb.png" alt="Output image from screen capture"></a></p>
  
  <p>Looks like the android runs in a virtual machine (probably virtual Box), not sure if that's the problem and if there is a way to capture virtual screens like this.</p>