PrintWindow和Microsoft Edge [英] PrintWindow and Microsoft Edge

查看:117
本文介绍了PrintWindow和Microsoft Edge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Windows 10(内部版本10166)上的PrintWindow函数遇到问题.当我们调用PrintWindow( https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd162869(v=vs.85).aspx )捕获Microsoft Edge(Project Spartan)浏览器窗口的图像,我们得到了黑色图片.

we have a problem with the PrintWindow function on Windows 10 (build 10166). When we call PrintWindow (https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd162869(v=vs.85).aspx) to capture a image of the Microsoft Edge (Project Spartan) browser window we get a black image.

有人知道这个原因吗,怎么解决/避免呢?也许还有其他捕获窗口图像的方法,该图像可以在背景中并隐藏在另一个窗口的后面?

Does anyone know the reason of this and how could it be fixed/avoided? Or maybe some other way to capture image of a window, that can be in background and hided behind another windows?

更新:我们尝试发送WM_PRINTCLIENT和WM_PRINT消息,并使用WM_PRINT调用DefWindowProc,但是结果是一样的-只是黑色图像.我们还尝试使用BitBlt将窗口的DC复制到内存表面,但是它也不起作用.我们现在最好的解决方案是将浏览器窗口置于前台,捕获整个屏幕,并将屏幕截图裁剪为窗口的客户端大小.但是由于切换当前正在使用的应用程序,它可能会打扰和惹恼用户.

UPDATE: We've tried sending WM_PRINTCLIENT and WM_PRINT messages, and calling DefWindowProc with WM_PRINT, but results are the same - just a black image. We also tried to use BitBlt to copy window's DC to a memory surface, but it's not working too. Best solution that we have now is bringing browser window to foreground, capturing the entire screen and cropping screenshot to window's client size; but it can interrupt and annoy users because of switching application that's currently in use.

推荐答案

我在IE上遇到了同样的问题 尝试. 最稳定的结果是两次通话

I had the same problem with IE try this. The most stable result was with double call

PrintWindow(hWnd, hdcScreen, 0);
PrintWindow(hWnd, hdcScreen, PW_CLIENTONLY);

这篇关于PrintWindow和Microsoft Edge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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