手机截屏通过pc端显示
png图片不在工程目录下,并且png图片会发生变化
实现
CBitmap cBitmap;
CClientDC* pDC = new CClientDC(this);
BITMAP bitmap;
CDC memdc;
cBitmap.Attach(hBitmap);
memdc.CreateCompatibleDC(pDC);
memdc.SelectObject(hBitmap);
cBitmap.GetBitmap(&bitmap);
pDC->StretchBlt(0, 0, bitmap.bmWidth, bitmap.bmHeight, &memdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
memdc.DeleteDC();
cBitmap.DeleteObject();
img.Destroy();
显示出来的图片还需要调整大小
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull sdcard/screenshot.png