窗口截图
我正在尝试截取所有打开的窗口的屏幕截图,包括最小化的窗口。目前我正在使用这段代码: http://www.developerfusion.com/code/4630/capture -a-screen-shot/
但它不适用于最小化的窗口,并且自 Vista 以来存在玻璃效果的区域(如资源管理器标题栏)是黑色的。有人可以帮我吗?
我的目标是创建类似于 Flip 3D 的东西;如果有人也了解如何创建实时预览,那就太好了。
I'm trying to take screenshots of all open windows, also the minimized ones. Currently I'm using this code:
http://www.developerfusion.com/code/4630/capture-a-screen-shot/
But it doesn't work for minimized windows and the areas where there is a Glass effect since Vista like the explorer title bar are black. Can anyone help me out?
My objective is to create something similar to Flip 3D; it would be great if someone also knew something about how to create a live preview.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于玻璃效果区域:我认为它不起作用,因为这些区域可能是用一些奇怪的 DirectX 方法而不是正常的 GDI 绘制的。
对于最小化窗口问题:如果一个窗口被最小化,它的DC就不会被绘制(从概念上讲,它甚至没有存在的理由);您应该尝试向此类窗口发送 WM_PRINT 消息,要求它们在您提供的 DC 上绘制自己。这种方法的问题在于并非所有窗口都能正确处理 WM_PRINT。
For the glass effect areas: I think it doesn't work because those areas may be drawn with some strange DirectX method instead of normal GDI.
For the minimized windows problem: if a window is minimized, its DC isn't painted (conceptually, it doesn't even have a reason to exist); you should try to send to such windows a WM_PRINT message, asking them to paint themselves on the DC you'll provide them. The problem with this approach is that not all the windows handle correctly WM_PRINT.
我也找到了用于任务栏预览的 API:
DWM 缩略图概述
非常棒,它甚至允许您进行实时预览!
I've found the API that is used for the taskbar previews a.s.o.:
DWM Thumbnail Overview
Pretty awesome, it even allows you to do live previews!