Win32::Screenshot
I've just discovered Win32::Screenshot, a Perl module that not only allows one to capture the entire screen, but more importantly makes it easy to capture individual windows, or portions of windows.
Installation of the module was a bit of a pain. Even though there is a ppd file at http://theoryx5.uwinnipeg.ca/ppms/Win32-Screenshot.ppd it depends upon PerlMagick, which under more recent releases is properly named Image::Magick and can be selected as part of the windows ImageMagick installer. I quickly hacked together my own ppd file that simply omits the dependency section. Besides from that, the whole thing worked like a charm.
So why is Win32::Screenshot so useful? Well, a lot of Windows programs have no command-line interface. If you want to communicate with them, you have no choice but to use the GUI. That's fine for humans, but what if you want to perform automated testing, or automatically watch a window for a particular event? Then Win32::Screenshot, especially in conjunction with Win32::GuiTest, really shines.
I've been joking with my friends that I'm going to use all this to play Puzzle Pirates automatically. In reality I have a much more interesting (but unfortunately secret) project at hand.