How can I print screen minimized windows?

拥有回忆 提交于 2019-12-07 05:04:21

问题


How can I print screen minimized windows? I believe it's possible, since Windows task-bar can create a preview of a window even if it is minimized.


回答1:


I'm pretty confident that this is not possible, at least by an external application like yours. When an application window is minimized, the window cannot (and does not) receive WM_PAINT messages, meaning that it is impossible to ask the window to redraw itself while it is minimized (or, "take a picture of it"). This is a limitation (or a rule) of the Windows API.

The taskbar "gets around this" by displaying a cached image (which is the last snapshot the DWM took of the window before it was minimized) and so it is not in fact taking a current picture of the window. You can test this by running an application which periodically updates itself, and then minimizing it -- you will see that the preview image will not be updated until it is restored.

The only way you could get around this is to do what the taskbar does -- periodically take a picture of the window you want, and when it is minimized, use the cached image instead. Of course, this means your app will have had to have been following the target window some time in advance (this obviously won't work if the first time you want to take a snapshot of the window is while it is minimized).




回答2:


This guy managed to do exactly what you are after: http://www.codeproject.com/Articles/20651/Capturing-Minimized-Window-A-Kid-s-Trick I know this question is really old, but it can still be valid for someone.



来源:https://stackoverflow.com/questions/1517512/how-can-i-print-screen-minimized-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!