Loading ...
Sorry, an error occurred while loading the content.

spy.pl

Expand Messages
  • Gabor Szabo
    Based on the spy--.pl in the eg directory of the distributions I started to write a bit more roboust spy program that later on I ll check in the repository. I
    Message 1 of 2 , Jul 14, 2004
    View Source
    • 0 Attachment
      Based on the spy--.pl in the eg directory of the distributions
      I started to write a bit more roboust spy program that later on
      I'll check in the repository. I am sure I'll need some help with it so let
      me start with my questions.

      What I am trying to do is to map the window hierarchy in the system.
      If I am not mistaking the id of the parent of all windows is 0 (and
      not the desktop Window), am I right on this ?

      Running my script (added below) I get output that looks like this just
      longer.


      + 0 , ' ', Rect:2245084,27 ,27 ,2245136 ''
      ++ 131318 , 'WorkerW ', Rect:0 ,0 ,0 ,0 ''
      + 65682 , 'BaseBar ', Rect:2 ,199,2 ,199 ''
      ++ 65684 , 'MenuSite ', Rect:26 ,202,26 ,202 ''
      +++ 65686 , 'SysPager ', Rect:26 ,202,26 ,202 ''
      ++++ 65688 , 'ToolbarWindow32 ', Rect:26 ,202,26 ,298 ''
      loop 65688
      +++ 262362 , 'ToolbarWindow32 ', Rect:26 ,-70,26 ,-70 ''
      loop 65686
      loop 65688
      loop 262362
      + 196858 , 'SysFader ', Rect:0 ,0 ,0 ,0 'SysFader'



      I wonder if anyone could explain
      1) why is the reture value of GetChildDepth(0, 0) 1 ?
      2) From my script it seems there are window id-s that are the children
      of more than one window. I thought every window is the child of only
      one window.
      3) How come the coordinates of some of the windows are, ehem , strange ?
      2245084 for window id 0
      -70 for window id 262362

      4) What are my bugs ?

      regards
      Gabor

      And the script:



      #!perl -w
      use strict;

      # $Id:$


      use Win32::GuiTest qw(:ALL);
      my %seen;
      my $desktop = GetDesktopWindow();
      my $root = 0;

      parse_tree(0);


      sub parse_tree {
      my $w = shift;
      if ($seen{$w}++) {
      print "loop $w\n";
      return;
      }

      prt($w);
      foreach my $child (GetChildWindows($w)) {
      parse_tree($child);
      }
      }



      sub prt {
      my $w = shift;
      printf "%-8s %-10s, '%-25s', Rect:%-3s,%-3s,%-3s,%-3s '%s'\n",
      "+" x GetChildDepth($root, $w),
      $w,
      GetClassName($w),
      GetWindowRect($w),
      GetWindowText($w);
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.