请高手指点,在做截图功能,但是只能在窗口内进行截图,有什么办法对整个屏幕中的任意部分截图的吗
HBITMAP CPSTestDlg::GetSrcBit(void)
{
HBITMAP hBitmap,hOldBitmap;
CPaintDC dc(this);
HDC hmyMemDC = CreateCompatibleDC(dc.m_hDC);
hBitmap = CreateCompatibleBitmap(dc.m_hDC, WIDTH, HEIGHT);
hOldBitmap = (HBITMAP)SelectObject(hmyMemDC, hBitmap);
BitBlt(hmyMemDC, 0, 0, WIDTH, HEIGHT,dc.m_hDC, 0, 0, SRCCOPY);
hBitmap = (HBITMAP)SelectObject(hmyMemDC, hOldBitmap);
return (hBitmap);
}
1 HBITMAP CPSTestDlg::GetSrcBit(void) 2 { 3 HBITMAP hBitmap,hOldBitmap; 4 HDC dc=::GetDC(NULL); 5 HDC hmyMemDC = CreateCompatibleDC(dc); 6 hBitmap = CreateCompatibleBitmap(dc, WIDTH, HEIGHT); 7 hOldBitmap = (HBITMAP)SelectObject(hmyMemDC, hBitmap); 8 BitBlt(hmyMemDC, 0, 0, WIDTH, HEIGHT,dc, 0, 0, SRCCOPY); 9 hBitmap = (HBITMAP)SelectObject(hmyMemDC, hOldBitmap); 10 return (hBitmap); 11 }
谢谢~~
对整个屏幕中的任意部分截图功能使用GDI确定区域。
参考:http://www.cnblogs.com/wenyang-rio/archive/2013/01/23/2865958.html
谢谢,不过有没有C++的,