[python-win32] Absence of PrintWindow?

Tim Roberts timr at probo.com
Wed Dec 19 19:08:14 CET 2007

Chris Ashurst wrote:
> I'm in the process of writing a little screenshot utility, and I've hit a
> snag. I currently take a screenshot of a frame via the usual method of
> building the various DC's, BitBlt'ing and so on, but the problem I have is
> that I'm trying to grab screenshots of windows that are obscured by other
> windows (so as to not disturb the current z-index of all windows as they
> stand).
> I was beginning to feel that what I required would not be possible, until I
> found an article at CodeProject
> (http://www.codeproject.com/KB/cs/CapturingMinimizedWindow.aspx) that
> basically had what I needed (and was also for the most part all win32api
> calls, even though the author used C#). As far as I could tell, apart from
> some simple registry/bithacks, the author makes a call to PrintWindow(), and
> that's where my hunt went cold - I cannot find PrintWindow in the wrapped
> win32 stuff.
> This is all a really long-winded (my apologies) way of asking if PrintWindow
> *is* in Pythonwin, and if not, that's fine - I just need to save my sanity
> from hunting for something that isn't there :)

I actually blogged about this issue two years ago:

The short answer is this:  what you want is impossible in the general
case.  It works for some applications, but not the interesting ones. 
PrintWindow sends a WM_PRINT message to the app, and very few
applications support WM_PRINT.  It REQUIRES the cooperation of the

This situation may improve in the future.  Under Vista, with Aero, the
full image of all windows is always available.  The window images are
drawn into offscreen textures, and the visible desktop is composited
from those textures.  The overlap happens during compositing.

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the python-win32 mailing list