Hello people. I am using GDI+ to take window snapshot, the code is:
CComBSTR bstrfname (fname);
HDC hdc = CreateCompatibleDC (hDC);
HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT);
HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp);
BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY);
Gdiplus::Bitmap *bmp = new Gdiplus::Bitmap (hbmp, NULL);
CLSID encoderClsid; GetEncoderClsid (L"image/png", &encoderClsid);
bmp->Save (bstrfname, &encoderClsid, NULL);
delete bmp;
SelectObject (hdc, hbmp0);
DeleteObject (hbmp);
DeleteDC (hdc);
where hDC is set before with:
hWnd=CreateWindowEx(...); hDC=GetDC(hWnd);
this works perfectly for small windows, but once I try windows bigger than screen, result looks like this:
i.e. taskbar is getting saved too. what gives?