I'm pretty sure this is not possible, at least with an external application like yours. When the application window is minimized, the window cannot (and does not receive) WM_PAINT messages, which means that it is impossible to request that the window redraw itself when it is minimized (or, "take a picture of it"). This is a limitation (or rule) of the Windows API.
The taskbar "circumvents this" by displaying the cached image (which is the last shot that DWM took from the window before drilling it), and therefore it does not actually display the current image of the window. You can verify this by running an application that periodically updates itself and then minimizes it - you will see that the preview image will not be updated until it is restored.
The only way you can get around this is to do what the taskbar does - periodically take a snapshot of the desired window, and when it is minimized, use a cached image instead. Of course, this means that your application should have previously monitored the target window (this obviously will not work if the first time you want to take a picture of the window while it is minimized).
GRB
source share