Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do you toggle the system tray icon using Win32::Gui?

by Moonie (Friar)
on Oct 01, 2001 at 22:56 UTC ( [id://115938]=note: print w/replies, xml ) Need Help??


in reply to How do you toggle the system tray icon using Win32::Gui?

vroom, take a look at this: example script - it may give you some ideas. Check out this brief tutorial: Win32-GUI-How To - under System Tray Icon. Also, about the icon disappearing - is a bug.
There is a small bug in this program. The tray icon does not disappear + immediately when the program terminates. Instead, it remains in the +system tray until you point the mouse cursor at it, when it disappear +s. This is a bug in Win32::GUI - when you close your program, you sho +uld explicitly remove any system tray icons you still have displayed. + Win32::GUI does not (yet) have a way of removing a tray icon. Hopefu +lly, this will be fixed in a later version.

Good Luck,
- Moon

Replies are listed 'Best First'.
Re: How do you toggle the system tray icon using Win32::Gui?
by jehuni (Pilgrim) on Oct 01, 2001 at 22:59 UTC

    I think that this bug actually leaves the icon there even when the app that placed it there has exited. However, at least under 2000, this bug no longer seems to be present.

    -jehuni

      I am running 2000 and I still get this bug. However this doesn't really answer the question of "changing" the icon. The documentation already mentioned says : <blockquot>Win32::GUI does not (yet) have a way of removing a tray icon As far as I can see, there is no way of "changing" the icon either. All you can do is add a new one. But if you can't delete the old one, that's no use either. Try out this code and tell me if the icons still disappear\change as they should (It doesn't on my system):
      use Win32::GUI; my $main = Win32::GUI::Window->new(); my $icon = Win32::GUI::Icon->new('test.ico'); my $tray = $main->AddNotifyIcon( -name => 'tray', -icon => $icon, -id => 0, -tip => 'icon1' ); sleep 5; # hover mouse over icon to see tooltip undef $tray; # try and get rid of old icon $tray = $main->AddNotifyIcon( -name => 'tray', -icon => $icon, -id => 0, -tip => 'icon2' ); sleep 5; # hover mouse over new icon again


      Simon Flack ($code or die)
      $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
      =~y'_"' ';eval"die";print $_,lc substr$@,0,3;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://115938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found