efficiently acquiring a screenshot of the windows desktop

烈酒焚心 提交于 2019-11-26 21:42:04

问题


Is there a more efficient way of getting a copy of the windows desktop ( using GDI or any other library ) than the code below

HDC      dcDesktop;
HDC         dcMem;
HBITMAP     hbmpMem;
HBITMAP     hOriginal;
BITMAP      bmpDesktopCopy;

dcDesktop   = GetDC( GetDesktopWindow() ); 
dcMem       = CreateCompatibleDC( dcDesktop );
hbmpMem     = CreateCompatibleBitmap( dcMem, m_lWidth, m_lHeight );

BitBlt( dcMem, 0, 0, m_lWidth, m_lHeight, dcDesktop, 0, 0, SRCCOPY );

// Copy the hbmpMem to the desktop copy
GetObject(hbmpMem, sizeof(BITMAP), (LPSTR)&bmpDesktopCopy);

回答1:


http://www.codeproject.com/KB/dialog/screencap.aspx

This page has a couple different ways to take screenshots. The DirectX method they use seems simple enough.

Aside from what's mentioned in that article, I don't think there's any more an efficient method of capturing the desktop.



来源:https://stackoverflow.com/questions/5292700/efficiently-acquiring-a-screenshot-of-the-windows-desktop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!