Capturing a windows frame using GetDIBits when computer is lock

When I use GetDIBits to capture the window frame in CPU memory that functions correctly.
But when the computer is locked (using CTRL+ALT+SUPPR and “Lock this computer” option or when the timeout of screen saver is reached) getDI does not capture any more the image of the target window but only the desktop under the target window.

Is somebody who would have a solution to authorize the image capture of a windows when the computer is locked.

If your windows aren’t displayed, they can’t be expected to contain valid pixel data to capture.
(Sidenote: For OpenGL rendering, conditions like these would fail the pixel ownership test. glReadPixels would fail similarly.)

If I remember correctly the Windows lock screen is a separate desktop and none of the windows you want to capture are actually displayed which makes this operation impossible on a standard desktop.
That’s basically an intended security feature. You wouldn’t want that a print-screen functionality could capture application windows contents during the lock screen.