I'm not a Win32 programmer by any means, but that's how I understand your requirements.my $id = 1; sub Yes_Mail { $main_window->TrayIconMailNo->{-id}); $main_window->{'TrayIconMailNo'}->DESTROY(); $main_window->AddNotifyIcon ( -icon => $tray_icon_file_mail_yes, -id => $id++, -name => "TrayIconMailYes", -tip => "LupoX POP3 Notifier(TM) - YOU HAVE MAIL" );
A couple of other things could be stronger. Build a hash of event numbers and handlers instead of a large if/else switch:
my %events = ( 512 => sub { print "mouse over icon\n" }, 513 => sub { print "left button clicked\n"; }, # et cetera ); if (exists $events{$msg}) { $events{$msg}->(); }
You can also avoid reading all of the lines in a file to see if there are new messages:
open (NEW, 'mail.tmp') or die "Cannot open mail.tmp: $!\n"; if (defined(my $line = <NEW>)) { Yes_Mail(); } close NEW;
In reply to Re: Win32::GUI Task Bar Icon Bug or bad programming?
by chromatic
in thread Win32::GUI Task Bar Icon Bug or bad programming?
by LupoX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |