如何在 Win32 中等待窗口完成绘制?
我使用PrintWindow函数来获取某个窗口的屏幕截图。
然而,由于某些原因,对PrintWindow的调用通常在窗口正在绘制时触发,因此窗口中尚未绘制的某些部分是全黑的。
有什么办法可以等待窗口完成绘制吗?
I use the function PrintWindow to get the screenshot of a certain window.
However, due to certain reason, the call to PrintWindow usually triggered when the window is drawing itself, and thus some parts of the window which have not been drawn yet are totally black.
Any solution to wait for the window to finish its painting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
等待窗口完成绘制并不能解决问题。或者,换句话说,问题不在于当目标窗口处于其绘制周期的一部分时调用
PrintWindow
。PrintWindow
的功能是向目标窗口发送WM_PRINT
(或WM_PRINTCLIENT
)消息,然后等待目标窗口的消息队列处理该消息。排队的消息不会交错。为了弄清楚实际问题的真相,我认为您需要提供更多细节。
Waiting for the window to finish its painting is not the solution to the problem. Or, put another way, the problem is not that
PrintWindow
is called whilst the target window is part way through its paint cycle.PrintWindow
functions by posting aWM_PRINT
(orWM_PRINTCLIENT
) message to the target window and then waiting for the target window's message queue to process that message. Queued messages do not interleave.In order to get to the bottom of the actual problem I think you will need to supply more details.