如何动态截取屏幕

「已注销」 2007-03-31 04:14:07
我想编写一个程序,可以动态截取屏幕,不知在VC++该如何实现?
...全文
295 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
会思考的草 2007-04-01
  • 打赏
  • 举报
回复
When video mirroring is active, each time the system draws to the primary video device at a location inside the mirrored area, a copy of the draw operation is executed on the mirrored video device in real time. With this mirroring scheme, you can simultaneously draw the same output to several video devices.
会思考的草 2007-04-01
  • 打赏
  • 举报
回复
在%DDKROOT%\src\video\displays\mirror下面。
会思考的草 2007-04-01
  • 打赏
  • 举报
回复
最完美的是使用mirror驱动。
losky 2007-03-31
  • 打赏
  • 举报
回复
CDC dc;
dc.CreateDC("DISPLAY",NULL,NULL,NULL);

char filename[128];
memset(filename,0,sizeof(filename));

int nX = 0;
int nY = 0;
int Width=GetSystemMetrics(SM_CXSCREEN);
int Height=GetSystemMetrics(SM_CYSCREEN);

CBitmap bm;
bm.CreateCompatibleBitmap(&dc,Width,Height);
CDC tdc;
tdc.CreateCompatibleDC(&dc);
CBitmap *pOld=tdc.SelectObject(&bm);
tdc.BitBlt(0,0,Width,Height,&dc,nX,nY,SRCCOPY);
tdc.SelectObject(pOld);

BITMAP btm;
bm.GetBitmap(&btm);
DWORD size=btm.bmWidthBytes*btm.bmHeight;
LPSTR lpData=(LPSTR)GlobalAlloc(GPTR,size);

BITMAPINFOHEADER bih;
bih.biBitCount=btm.bmBitsPixel;
bih.biClrImportant=0;
bih.biClrUsed=0;
bih.biCompression=0;
bih.biHeight=btm.bmHeight;
bih.biPlanes=1;
bih.biSize=sizeof(BITMAPINFOHEADER);
bih.biSizeImage=size;
bih.biWidth=btm.bmWidth;
bih.biXPelsPerMeter=0;
bih.biYPelsPerMeter=0;

GetDIBits(tdc,bm,0,bih.biHeight,lpData,(BITMAPINFO*)&bih,DIB_RGB_COLORS);
BITMAPFILEHEADER bfh;
bfh.bfReserved1=bfh.bfReserved2=0;
bfh.bfType=((WORD)('M'<< 8)|'B');
bfh.bfSize=54+size;
bfh.bfOffBits=54;
bm.DeleteObject();
tdc.DeleteDC();
dc.DeleteDC();
CFile bf;
if(bf.Open(csFolder,CFile::modeCreate|CFile::modeWrite)){
bf.WriteHuge(&bfh,sizeof(BITMAPFILEHEADER));
bf.WriteHuge(&bih,sizeof(BITMAPINFOHEADER));
bf.WriteHuge(lpData,size);
bf.Close();
}
else
return ;

GlobalFree(lpData);

return ;

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧