# $Id: spy--.pl,v 1.1 2001/06/17 09:17:10 erngui Exp $ # # MS has a very nice tool (Spy++). # This is Spy-- # use strict; use warnings; use Win32::GuiTest qw/ IsWindowVisible IsWindowEnabled FindWindowLike GetWindowText GetClassName GetChildDepth GetDesktopWindow /; use Win32::API; BEGIN { Win32::API::->Import("user32","DWORD GetWindowThreadProcessId( HWND hWnd, LPDWORD lpdwProcessId)") or die $^E; } # desireable windows # top level windows (children of desktop , depth 1) # visible, enabled, have window title my $DesktopWindow = GetDesktopWindow(); for (FindWindowLike((undef) x 4, 1)) { next unless IsWindowEnabled($_) or IsWindowVisible($_); my $s = sprintf "0x%08X %8d %-30s '%s'", $_, GetWindowThreadProcessId($_,undef), GetClassName($_), GetWindowText($_) || next; print "+" x GetChildDepth($DesktopWindow, $_), $s, "\n"; }