The Spy-- Sample


There is a nice Microsoft graphical tool called MS Spy++. It allows you to explore all the Windows you have open and to see the internal properties of each window. That's how I came up with the Spy-- GuiTest sample. It goes through all windows in the system and spits out some basic information about them (window caption and such).

The code

# $Id: guitest-spy.html,v 1.2 2002/11/19 00:49:41 erngui Exp $
# MS has a very nice tool (Spy++).
# This is Spy--
use Win32::GuiTest qw/FindWindowLike GetWindowText GetClassName
    GetChildDepth GetDesktopWindow/;

for (FindWindowLike()) {
    $s = sprintf("0x%08X", $_ );
    $s .= ", '" .  GetWindowText($_) . "', " . GetClassName($_);
    print "+" x GetChildDepth(GetDesktopWindow(), $_), $s, "\n";