截取任务栏图像的问题
cdchq 2015-02-02 07:10:26 HWND hShellTrayWnd;
hShellTrayWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL);
CRect rect;
::GetWindowRect(hShellTrayWnd, &rect);
HDC hdcSrc = ::GetDC(hShellTrayWnd);
int nBitPerPixel = GetDeviceCaps(hdcSrc, BITSPIXEL);
CImage image;
image.Create(rect.Width(), rect.Height(), nBitPerPixel);
BitBlt(image.GetDC(), rect.left, rect.top, rect.right, rect.bottom, hdcSrc, 0, 0, SRCCOPY);
::ReleaseDC(hShellTrayWnd, hdcSrc);
image.ReleaseDC();
image.Save(_T("j:\\1.bmp"));
上面代码,最后得到的结果,bmp图片的大小对了,但整个图片是黑色的,不知怎么回事?