Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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
Replies are listed 'Best First'.
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2015-07-07 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls