## put into the top of your main code ## Show fatal error dialog sub dying { my ($error) = @_; use Tk; use Win32::Sound; ##>> use Win32Util; ##%% if (!$error) { $error = "(none given)"; } my $text; $text .= "\n\nError:\n\n$error"; my $box = new MainWindow(-title => "Error", -bg => 'yellow', -bd => 4, -relief => 'ridge'); $box->overrideredirect(1); my $label = $box->Label( -textvariable=> \$text, -bg=> 'yellow', )->pack(-fill=>'both', -padx => 40, ); Win32::Sound::Play('SystemExclamation'); ##>> my $ok = $box->Button(-text => "OK", -command => [ sub{print STDOUT "User selected 'OK' on error message\n"; $box->destroy; exit; } ] )->pack(-padx => 20, -pady => 20 ); $box->withdraw; $box->Popup; Win32Util::keep_on_top($box, 1); ##%% MainLoop; }