[問題] 抓取某個視窗的畫面
平台VC++ 2010 Win7 32bit
我想抓取某個視窗的畫面
在網路上看到這段程式說可以用
想問一下
1.為什麼它用的陣列大小是width*height*4(要乘以四呢?)
2.這樣抓到的bitmap位元數是16bit的嗎?
::GetWindowRect(hwndAbout,&aRect);
int width = aRect.bottom;
int height = aRect.right;
HDC hdc;
hdc=::GetDC(hwndAbout);
HDC memDC = ::CreateCompatibleDC (hdc);
HBITMAP bitmap = ::CreateCompatibleBitmap(hdc,width,height);
//copy
HGDIOBJ old = ::SelectObject (memDC, bitmap);
::BitBlt(memDC,0,0,width,height,hdc,0,0,SRCCOPY);
unsigned char *pixels = new unsigned char[width*height*4];
::GetBitmapBits(bitmap,width*height*4,pixels);
::SelectObject (memDC, old);
DeleteObject(bitmap);
DeleteDC(memDC);
DeleteDC(hdc);
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.233.186.250
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1403871440.A.DE6.html
→
06/27 21:17, , 1F
06/27 21:17, 1F
→
06/28 09:15, , 2F
06/28 09:15, 2F
→
06/28 09:15, , 3F
06/28 09:15, 3F
→
06/28 09:57, , 4F
06/28 09:57, 4F
→
06/28 17:53, , 5F
06/28 17:53, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章