如何在屏幕上的特定点找到窗口以进行屏幕截图/屏幕录制?

发布于 2024-09-01 20:19:57 字数 468 浏览 2 评论 0原文

我正在寻找一种方法来完成相当于 WindowFromPoint 和 GetWindowRect 在 Carbon/Cocoa 和 X11 中所做的事情。

WindowFromPoint - http://msdn.microsoft.com/ en-us/library/ms633558%28VS.85%29.aspx GetWindowRect - http://msdn.microsoft.com/ en-us/library/ms633519%28VS.85%29.aspx

I'm looking for a way to do what the equivalent of WindowFromPoint and GetWindowRect do, in Carbon/Cocoa and X11.

WindowFromPoint - http://msdn.microsoft.com/en-us/library/ms633558%28VS.85%29.aspx
GetWindowRect - http://msdn.microsoft.com/en-us/library/ms633519%28VS.85%29.aspx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

丶情人眼里出诗心の 2024-09-08 20:19:57

我正在开发屏幕截图和屏幕录制应用程序......

使用 石英窗服务

我想...确定窗口的边界矩形,然后使用窗口的坐标捕获屏幕该区域的位图...

肯定使用 Quartz Window Services。

顺便说一句,它的功能之一是您可以单独捕获一个窗口,而窗口前面或后面没有任何东西。执行此操作时,您不需要获取其矩形。

...并将其保存到文件中...

使用 CGImageDestination

...或将其编码到视频流中。

这部分我不确定。 有关此事的示例代码(顾名思义,它使用用于实际捕获的 OpenGL)使用仅限 32 位的 QuickTime C API,而不是兼容 64 位的 QuickTime Kit 来编写影片。

I am developing screenshot and screen recording apps …

Use Quartz Window Services.

I want to … determine the bounding rectangle of the window, and then use the coordinates of the window to capture a bitmap of that area of the screen …

Definitely use Quartz Window Services.

Incidentally, one of its features is that you can capture a window in isolation, without anything that may be in front of it or behind it. You don't need to get its rectangle when doing this.

… and save it to a file …

Use CGImageDestination.

… or encode it into a video stream.

That part I'm not sure about. The sample code on the matter (which, as its name says, uses OpenGL for the actual capturing) uses the 32-bit-only QuickTime C API, not the 64-bit-compatible QuickTime Kit, to write the movie.

所有深爱都是秘密 2024-09-08 20:19:57

要回答此问题的 X11 部分:您可以使用 XQueryPointer的 child_return 具有与 WindowFromPont 类似的功能。 XGetGeometry 应该为您提供 GetWindowRect 信息。

To answer the X11 portion of this question: You can use XQueryPointer's child_return for similar functionality to WindowFromPont. XGetGeometry should get you the GetWindowRect information.

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