在 Windows 7 中捕获子窗口屏幕的可靠方法是什么?
请原谅我的沮丧。我已经在很多地方询问过这个问题,而且我真的认为 Windows 7 SDK 中没有办法实现这一点。
我想要的只是捕获父窗口创建的“子窗口”( setParent() )的一部分。我曾经使用 bitblt() 来做到这一点,但问题是子窗口可以是任何类型的应用程序,在我的例子中,OpenGL 在其中的一部分中运行。如果我 bitblt() ,那么 OGL 部分会变成空白,不会写入 BMP。
DWM,特别是 dwmRegisterThumbnail() 不允许生成子窗口的缩略图。所以请给我一个方向。
谢谢。
Pardon my frustration. I've asked about this in many places and I seriously don't think that there wouldn't be a way in Windows 7 SDK to accomplish this.
All I want, is to capture part of a 'child window' ( setParent() ) created by a parent. I used to do this with bitblt() but the catch is that the child window can be any type of application, and in my case has OpenGL running in a section of it. If I bitblt() that, then the OGL part comes blank, doesn't get written to the BMP.
DWM, particularly dwmRegisterThumbnail() doesn't allow thumbnail generation of child windows. So please give me a direction.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我已经有一段时间没有这样做了,所以我的解释可能有点含糊,但据我所知,Windows 并没有“看到”窗口内渲染的 OpenGL。
Windows所做的就是创建指定大小的窗口,然后“将其交给”OpenGL进行渲染。这意味着您无法获取从代码的 Windows 端渲染的像素。
当我们想要捕捉 3D 效果时,我们必须将屏幕重新渲染为离屏位图,然后保存(或打印)。
显然,整个屏幕捕获(打印屏幕)是有效的,因为它正在读取最终像素。
It's been a while since I did any of this, so my explanation might be a bit vague, but from what I remember, the Windows doesn't "see" the OpenGL rendered inside the window.
What Windows does is create the window at the specified size and then "hands it over" to OpenGL for rendering. This means that you can't get at the pixels as rendered from the Windows side of the code.
When we wanted to capture the 3D we had to re-render the screen to an off screen bitmap which was then saved (or printed).
Obviously a whole screen capture (Print Screen) works because it's reading the final pixels.
我建议您:
抱歉,它需要更多工作,但它应该可以工作,这比您现在拥有的更好。
I suggest that you:
Sorry, its more work, but it should work, which is better than what you have right now.
这可能有帮助:
http://code。 google.com/p/telekinesis/source/browse/trunk/Mac/Source/glgrab.c?r=140
http://www.codeproject.com/KB/dialog/screencap.aspx
还有 Java 的 Robot 类 (http://java.sun.com/javase/6/docs/api/java/awt/Robot.html#createScreenCapture%28java.awt.Rectangle%29)
This may help:
http://code.google.com/p/telekinesis/source/browse/trunk/Mac/Source/glgrab.c?r=140
http://www.codeproject.com/KB/dialog/screencap.aspx
Also Java's Robot class (http://java.sun.com/javase/6/docs/api/java/awt/Robot.html#createScreenCapture%28java.awt.Rectangle%29)
我无法访问任何可能打开的子窗口的源代码,包括带有 OpenGL 的子窗口
I don't have access to the source code of any child window that may be open including the one with OpenGL