Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

System Tray Icon Disappears

by vaguy (Initiate)
on Mar 12, 2014 at 00:07 UTC ( #1077943=perlquestion: print w/ replies, xml ) Need Help??
vaguy has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl application that presents an icon in the system tray (Windows 8 calls it the notification area). I've seen it disappear once or twice but the app continues to run). I'm assuming this is because of an Explorer restart or crash. My research suggests I need to listed for a 'TaskbarCreated' message via a RegisterWindowMessage API call. I haven't seen any code snippets in perl that might get me going. Can anybody help me out here?

Comment on System Tray Icon Disappears
Re: System Tray Icon Disappears
by Anonymous Monk on Mar 12, 2014 at 00:29 UTC
      I'm using Active Perl with Tk and Win32::GUI().
      Calls are to Win32::GUI::Window->new and then to AddNotifyIcon.
      Code looks like this:
      sub SetupSystray{ $TrayIcon = new Win32::GUI::Icon('WebCam.ico'); $TrayWinHidden = Win32::GUI::Window->new( -name => 'TrayWindow', -text => 'TrayWindow', -width => 20, -height => 20, -visible => 0, ); $TrayNotify = $TrayWinHidden->AddNotifyIcon( -name => "WebCam-App", -icon => $TrayIcon, -tip => "WebCam", -balloon_icon => "info", -onRightClick => \&TrackTrayMenu, -onClick => \&ToggleProgWindow, ); $TrayMenu = Win32::GUI::Menu->new( "" => "Options", ">WebCam" => {-name => "WebCam"}, ">-" => 0, ">Open/Close" => {-name => "ToggleProg", -onClick => \&To +ggleProgWindow,-default => 1}, ">-" => 0, ">Exit" => {-name => "Exit",-onClick => \&CloseDownFrom +Tray} ) or prtFTL "Failed to create Tray Menu $!"; } sub CloseDownFromTray{ $mw->destroy; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1077943]
Front-paged by bulk88
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2015-03-30 11:07 GMT
Find Nodes?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:

    Results (638 votes), past polls