http://www.perlmonks.org?node_id=79710


in reply to Ignore-O-Matic

Cool little program beretboy !
This slightly modified version brings your DOS window back afterwards when running it from the commandline.
I know this code wasn't submitted for peer review but i couldn't resist :)
use Win32::Sound; use Win32::GUI; $MW = new Win32::GUI::Window( -title => 'Ignore-O-matic', -left => 100, -top => 100, -width => 150, -height => 175, -name => 'MainWindow', -visible => 1, ); $because = $MW->AddButton( -text => 'because!', -name => 'because', -left => 25, -top => 25, ); $quiet = $MW->AddButton( -text => 'Be Quiet!', -name => 'quiet', -left => 25, -top => 50, ); $goaway = $MW->AddButton( -text => 'Go AWAY!', -name => 'away', -left => 25, -top => 75, ); $nocare = $MW->AddButton( -text => 'I do not care!', -name => 'nocare', -left => 25, -top => 100, ); $important = $MW->AddButton( -text => 'More important!', -name => 'important', -left => 25, -top => 125, ); my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); Win32::GUI::Dialog(); sub MainWindow_Terminate { $MW->PostQuitMessage(1); Win32::GUI::Show($DOS); } sub quiet_Click { Win32::Sound::Play("bequite.wav"); return 0; } sub because_Click { Win32::Sound::Play("because.wav"); return 0; } sub away_Click { Win32::Sound::Play("goaway.wav"); return 0; } sub nocare_Click { Win32::Sound::Play("nocare.wav"); return 0; } sub important_Click { Win32::Sound::Play("moreimportant.wav"); return 0; }


Jorg

"Do or do not, there is no try" -- Yoda