use Win32::GUI; my $title_part = shift; my $class_part = shift; $title_part or die "Supply title substring\n"; $class_part ||= ''; my $perlwindow = GUI::GetPerlWindow(); for ( my $window = GUI::GetWindow( GUI::GetDesktopWindow(), GW_CHILD ); $window; $window = GUI::GetWindow( $window, GW_HWNDNEXT ) ) { next if $window == $perlwindow; my $title = GUI::Text($window); my $class = GUI::GetClassName($window); if ( $title =~ /$title_part/ and $class =~ /$class_part/ ) { warn "Minimizing $title: $class\n"; GUI::Minimize($window); } }