Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen capture ignores some windows

I am working in MFC and I am trying to capture a bmp of the desktop. I am using GetDC(NULL) to do this but it seems it ignores special skinned windows. It seems to ignore windows drawn with UpdateLayeredWindow. This behaviour seems to be happening only on Vista x64 and XP. I have also tried GetWindowDC with the desktop HWND but the result is the same.

NOTES: 1) Print Screen works. 2) On Vista if I enable Aero the screen captures are ok, "special" windows appear. So on Vista it only happens when Aero is disabled.

An ideas?

Thank you.

like image 866
Nemok Avatar asked Jul 28 '09 10:07

Nemok


People also ask

Why is Screenshot not working Windows 10?

Check If There Is an F Mode or F Lock Key on the Keyboard. If there is an F Mode key or F Lock key on your keyboard, the Print Screen not working Windows 10 may be caused by them, because such keys can disable the PrintScreen key. If so, you should enable the Print Screen key by pressing F Mode key or F Lock key again.

Why can't I take a screenshot on Windows?

Answer: Sometimes the presence of the F Mode key or F Lock key on the keyboard disables the PrtScn key, and the user is unable to take screenshots using PrtScn in Windows 10. These keys need to be pressed again in order to enable PrtScn to take screenshots in Windows.


2 Answers

When calling BitBlt(), add the CAPTUREBLT flag to "capture" layered windows

like image 169
Anders Avatar answered Oct 04 '22 22:10

Anders


This could be because of desktop composition. Turn off the Aero desktop composition in Vista and try it again.

like image 32
stevex Avatar answered Oct 04 '22 23:10

stevex