在 Windows 7 中捕获子窗口屏幕的可靠方法是什么?

发布于 2024-08-19 16:33:26 字数 293 浏览 4 评论 0原文

请原谅我的沮丧。我已经在很多地方询问过这个问题,而且我真的认为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

无畏 2024-08-26 16:33:26

我已经有一段时间没有这样做了,所以我的解释可能有点含糊,但据我所知,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.

最偏执的依靠 2024-08-26 16:33:26

我建议您:

  1. 忘记任务的缩略图部分(就捕获而言)。
  2. 计算你的窗户在哪里。
  3. 捕获全屏。
  4. 切除您感兴趣的区域(使用步骤 2 中的数据)。
  5. 重新缩放至适当的缩略图大小。

抱歉,它需要更多工作,但它应该可以工作,这比您现在拥有的更好。

I suggest that you:

  1. Forget the Thumbnail part of the task (in terms of capture).
  2. Calculate where your window is.
  3. Capture full screen.
  4. Excise the area you are interested in (using data from step 2).
  5. Rescale to the appropriate thumbnail size.

Sorry, its more work, but it should work, which is better than what you have right now.

难理解 2024-08-26 16:33:26

我无法访问任何可能打开的子窗口的源代码,包括带有 OpenGL 的子窗口

I don't have access to the source code of any child window that may be open including the one with OpenGL

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文