隐藏窗口的屏幕截图 [英] Screenshot of Hidden Window

查看:192
本文介绍了隐藏窗口的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要截取当前隐藏窗口的屏幕截图,而不必关注该窗口.我在这里看到了一篇文章:使用WinAPI的窗口截图

I need to take a screenshot of a currently hidden window without giving focus to that window. I saw a post on this, here: Window screenshot using WinAPI

我从来没有使用过这种方法,所以任何建议都将不胜感激.

I've never used this method, so any advice is greatly appreciated.

我希望能够在Windows或OS X中执行此操作,是否可以在OS X中执行此操作?不一定需要使用相同的语言或跨平台,但这当然是一个加号:).

I would like to be able to do this either in Windows or OS X, is it possible to do in OS X? It doesn't necessarily need to be in the same language or be cross platform, but of course, that's a plus :).

推荐答案

我将研究要求窗口将自身绘制为位图的可能性,而不是尝试使用屏幕快照对其进行拍照.那可能是使窗口最小化无关紧要的一种方法.类似于 WM_PRINT

I would investigate the possibility of asking the window to draw itself into a bitmap, rather than trying to take its picture with a screenshot. That might be a way of making it irrelevant that the window is minimized. Something like the WM_PRINT or WM_PRINTCLIENT message. I suspect that's actually what the person was trying to do who asked the original question that you linked to. The biggest pitfall is if the window doesn't handle that message appropriately. Not all apps are so well-behaved. Also, I don't think it works for windows that are truly hidden, but I can't tell from your question and the flurry of articles you link to whether or not that's a real concern.

不幸的是,我对OS X编程一无所知.我只是该平台上的用户.如果这对您真的很重要,您可以尝试深入Qt来源,以了解他们如何跨平台进行操作.

Unfortunately, I also know nothing about programming OS X; I'm just a user on that platform. You might try diving into the Qt sources to see how they're doing it cross-platform, if that's really important to you.

这篇关于隐藏窗口的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆