【发布时间】:2016-08-03 14:52:03
【问题描述】:
我正在尝试使用一些 win api 捕获 MEmu 模拟器屏幕,但我尝试的所有操作都一直黑屏,屏幕截图大小正确,但全黑。
这是我现在正在使用的一些代码:
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");
看起来 android 在虚拟机(可能是虚拟 Box)中运行,不确定是否是问题所在,是否有办法捕获这样的虚拟屏幕。
【问题讨论】: