However, what I think you're really looking for are the coordinates
for the top level windows, so there's no need for the processes. To do
this, you need to use the following Windows API's:

EnumWindows (uses a callback to identify each top-level window)
GetWindowText (to get the title of the window)
GetWindowInfo (returns a WINDOWINFO struct, which contains RECT
rcWindow, which is what you're looking for)

These API's are documented at Microsoft's MSDN library:
http://msdn.microsoft.com/library. Basically, the EnumWindows callback
is passed a window handle (hwnd) for each top-level window. The hwnd
can then be passed to GetWindowText and GetWindowInfo to get the
information you need about that window.

Apparently someone has already done it, via another module! Look at Win32::GuiTest. You can use FindWindowLike() and GetWindowText() to list all windows, and get their screen locations respectively.

The following is a simple sample code:
use Win32::GuiTest qw(FindWindowLike GetWindowText GetWindowRect);

my @windows = FindWindowLike();
foreach my $window (@windows)
{
   my $WindowText = GetWindowText($window);
   if ($WindowText and ($WindowText =~ /Thunderbird/))
   {
       print "$window,".GetWindowText($window)."\n";
       my @rect = GetWindowRect($window);
       print 'rect: '.join(',',@rect)."\n";
   }
}

Cool! Perl rocks!
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to