用GDI+截取窗口客户区图象,请大家帮忙看看我的代码为什么截不到图象呢?
前提:已经用GDI+加载了一幅图象。
功能:截取已存在的图象。
代码:
hdc=GetDC(hwnd); GetClientRect(hwnd,&rc); Graphics graphics(hdc); Bitmap bitmap(rc.right-rc.left,rc.bottom-rc.top,&graphics); bitmap.Save(wbuffer, &encoderClsid, NULL); //调试时,得到了正确的CLSID ReleaseDC(hwnd,hdc);