There is a task to capture certain (selected by user for example) windows in Windows 10, ideally it should be possible to capture the selected window without capturing anything extra, in particular, if any other window overlaps the window that we are capturing, this overlapping window is not should be captured. I tried to look for various APIs that could help in solving this task, however, unfortunately, so far no API has been able to reliably do this.
The most popular way that is mentioned everywhere is to use GDI and the GetDC()
/ GetWindowDC()
together with BitBlt()
. This approach worked fine with Aero enabled on Windows 7 and on applications like Notepad in Windows 10, but the problem is that Metro UI Apps is not captured in this way, the resulting bitmap is just black and contains nothing. Everything is complicated by the fact that most popular applications (browsers for example) change the way they render to Windows 10, so things like Google Chrome, Mozilla Firefox latest versions are not captured using this approach too (however, they are captured in previous versions of Windows). In a word, BitBlt()
as an API has become very unpredictable to work in Windows 10, some windows are captured, some windows are captured partially (the title part is not captured, the contents of the windows under the window being captured are captured), and if you try to capture, for example, Mozilla Firefox, the resulting bitmap will generally contain only the contents of the windows that are under the Mozilla Firefox window.
I also tried using PrintWindow()
and PrintWindow()
in conjunction with BitBlt()
, but I could not solve the problem.
Other possible capture methods are described here , but they also seem to be inappropriate (it seems that other methods do not distinguish between windows as such and can only capture the full screen or parts of this screen).
It seems to me that there should be a reliable way of capturing such applications, since TeamViewer, for example, somehow captures them.