# Test Icons from http://www.royaltyfreeart.com/favicons.html use Win32::GUI; use strict; my $okIcon = new Win32::GUI::Icon("info1.ico"); my $badIcon = new Win32::GUI::Icon("info2.ico"); my $lastState = 1; # start off ok my $iconCounter = 1; # maintain an icon count my $main = Win32::GUI::Window->new(); DoIcon($okIcon, $iconCounter); # set the initial icon while(1){ if (int rand 2) # Yeah, This is how I do system monitoring! { unless ($lastState) { # Everything's ok now - it wasn't last time round changeIcon($okIcon); $lastState = 1; } } else { if ($lastState) { # Something's gone down - everything was ok last check changeIcon($badIcon); $lastState = 0; } } sleep(5); } sub DoIcon { my ($icon, $id) = @_; $main->AddNotifyIcon( -name => "Tray", -tip => $id, -icon => $icon, -id => $id, ); } sub changeIcon { my $icon = shift; DoIcon($icon, $iconCounter); # Clear the old Icon DoIcon($icon, ++$iconCounter); # Set the new one and incriment counter }