4

I want to take a screenshot of desktop while Windows is locked (with Win+L). Standard methods make a black screen, with code of pixel:

COLORREF color = GetPixel(hdc, x, y);

equal -1. Neither a user mode program nor a service could capture a useful image. Any ideas?

RBerteig
  • 41,948
  • 7
  • 88
  • 128
Evgeny Bechkalo
  • 109
  • 1
  • 9
  • 1
    Are you trying to get an image of the desktop that would be displayed if it were unlocked, or a shot of the locked screen itself? – RBerteig Aug 13 '10 at 07:45
  • I'm trying to take screenshot of display if it was unlock, screenshot of Winlogon doesn't interest me) – Evgeny Bechkalo Aug 13 '10 at 08:20

1 Answers1

3

GetPixel and BitBlt won't work when the desktop isn't physically displayed on the monitor.

You may have some luck capturing individual windows with PrintWindow. However, not all applications respond to PrintWindow calls the same way, so you may see glitches and/or blackness. You'll also need to capture each window individually.

Tim Robinson
  • 53,480
  • 10
  • 121
  • 138
  • I correctly understand you: you suggest to organize a cycle and make a screenshot of everyone window? If I will use HWND parameter equal 0, it will copy to DC all desktop? In spite of all, thank you. – Evgeny Bechkalo Aug 13 '10 at 08:25
  • It'll ask the desktop to paint itself into the `HDC` of your choice, which I think gets you a copy of the user's wallpaper, and possibly their icons. – Tim Robinson Aug 13 '10 at 08:34
  • Anticreativshik, did you get any results? – Cees Timmerman Nov 10 '11 at 10:53
  • Cees, yes, a had result, but result was negative. I couldn't get any image in this way, and we closed ticket in bugtracker with mark "as designed" – Evgeny Bechkalo Aug 16 '13 at 04:04