您的位置:首页 > 其它

VC屏幕截图并保存为bmp、jpg、png等格式文件

2013-11-25 10:41 411 查看
int main()
{
HDC hdcSrc = GetDC(NULL);
int nBitPerPixel = GetDeviceCaps(hdcSrc, BITSPIXEL);
int nWidth = GetDeviceCaps(hdcSrc, HORZRES);
int nHeight = GetDeviceCaps(hdcSrc, VERTRES);
CImage image;
image.Create(nWidth, nHeight, nBitPerPixel);
BitBlt(image.GetDC(), 0, 0, nWidth, nHeight, hdcSrc, 0, 0, SRCCOPY);
ReleaseDC(NULL, hdcSrc);
image.ReleaseDC();
image.Save(L"1.png", Gdiplus::ImageFormatPNG);//ImageFormatJPEG
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐