I am starting to believe that you can do nothing with Windows API.
I have two windows. One has a DWM thumbnail in it. What I want to do is, I want to be able to capture the screen of the window with the thumbnail into the other one. When I do this, using bitblt, everything is copied except the thumbnail. It just isn't there in the bitmap.
So how does the DWM rendering work? I mean, if DWM renders thumbnails directly onto the DC of the registered window, then my approach should work. I'm confused.
Thanks a bunch.
That's not how DWM works: the contents of the thumbnail are never blitted onto the DC of your window. Instead, the DWM composition engine will render the thumbnail directly over the contents of your window when the desktop is presented.
There's no (official) way to access the image data of a DWM thumbnail unfortunately (there is however a hack on the net that tries to access the underlying vertex data and render it in DirectX 9).
Use
DwmRegisterThumbnail
DwmUnregisterThumbnail
DwnUpdateThumbnailProperties
You cannot expect a thumbnail to be place in a window's device context, because the thumbnail is not placed in a window's device context. So your approach will not work.
But if you're trying to steal the thumbnail of an application, just ask the Dwm to give you it's thumbnail. That will allow you to present to the user the exact thumbnail you want.
If, on the other hand, you want to access the pixels in the thumbnail of another process, then you have a problem.
来源:https://stackoverflow.com/questions/2196268/is-it-possible-to-capture-a-window-with-windows-7-dwm-thumbnail-in-it