高效获取windows桌面截图
有没有比下面的代码更有效的方法来获取 Windows 桌面的副本(使用 GDI 或任何其他库)
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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.codeproject.com/KB/dialog/screencap.aspx
此页面有几种不同的截屏方法。他们使用的 DirectX 方法看起来很简单。
除了那篇文章中提到的内容之外,我认为没有更有效的捕获桌面的方法。
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.