截取特定窗口的截图 - C ++ / Qt [英] Taking screenshot of a specific window - C++ / Qt
问题描述
在Qt中,如何截取特定窗口的屏幕截图(即假设我有记事本,我想要截取一个标题为Untitled - Notepad的窗口)?
在他们的屏幕截图示例代码中,他们显示如何截取整个桌面的屏幕截图:
In Qt, how do I take a screenshot of a specific window (i.e. suppose I had Notepad up and I wanted to take a screenshot of the window titled "Untitled - Notepad")? In their screenshot example code, they show how to take a screenshot of the entire desktop:
originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
如何获取特定窗口的winId()(假设我知道窗口的标题) Qt?
How would I get the winId() for a specific window (assuming I knew the window's title) in Qt?
感谢
推荐答案
-具体。 winIds是Windows上的HWND,因此您可以在您给出的示例中调用 FindWindow(NULL,Untitled - Notepad)
。
I'm pretty sure that's platform-specific. winIds are HWNDs on Windows, so you could call FindWindow(NULL, "Untitled - Notepad")
in the example you gave.
这篇关于截取特定窗口的截图 - C ++ / Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!