Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Answer: How do I minimize an application's window? (Win32)

( #57859=categorized answer: print w/ replies, xml ) Need Help??

Q&A > GUI Programming > How do I minimize an application's window? (Win32) contributed by alftheo

Win32::GUI has a function to minimize a window. The tricky part is finding the window you want to minimize; it might not be the only window in the application.

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); } }

Comment on Answer: How do I minimize an application's window? (Win32)
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-12-19 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (94 votes), past polls