Win32::GuiTest can't bring minimized program to foreground

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have a simple script where I am trying to bring a minimized program
to the foreground to send keystrokes. I have the following output from
the run. The SetActiveWindow, SetForegroundWindow functions just seem
to be ignored. Any Ideas are welcome. I'm running on XP Pro.  I do
have Paint launched, but minimized.

* Could not set the window id: 1843712 active
* Window id: 1843712 brought to foreground        <<<This never did
bring it up
happen, even though it said so
1843712>        'untitled - Paint'

use Win32::GuiTest qw(:ALL);
use Win32::GUI;

  $Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode

  my @windows = FindWindowLike(0, "Paint", "");
  print "Windows:@windows:\n";
  for (@windows) {
     my $success = 1;

     if ( SetActiveWindow($window) ) {
         print "* Successfully set the window id: $window active\n";
     else {
         print "* Could not set the window id: $window active\n";
         $success = 0;
     if (SetForegroundWindow($window) ) {
         print "* Window id: $window brought to foreground\n";
     else {
         print "* Window id: $window could not be brought to
         $success = 0;

      print "$_>\t'", GetWindowText($_), "'\n";


Site Timeline