Thank you Cam.  Your solution will work fine in one of my applications, where
the icon changes are infrequent.  If the changes are too often, there's
objectionable flicker on the taskbar when it shrinks for the deleted icon and
grows back for the next icon.  

Thanks again for your help.

Hoff Miller





>X-Apparently-From: <[EMAIL PROTECTED]>
>From: Cam <[EMAIL PROTECTED]>
>X-Priority: 3 (Normal)
>To: Hoff Miller <[EMAIL PROTECTED]>
>Subject: Re: [perl-win32-gui] system tray icon
>Mime-Version: 1.0
>Content-Transfer-Encoding: 7bit
>
>Hello Hoff,
>
>I  wasn't  able to come up with a way to change the icon in the system
>tray.  My  solution  was to kill off the current tray icon and create a
>new  one  whenever it need to be changed. In order to get this to work
>properly I had to assign an "id" to each one, and increment it so that
>whenever  I killed off the icon and created a new one it had a new id.
>I  know  my  explanation  doesn't make much sence... hopefully my code
>will  explain it better. If someone does know how to change the icon I
>would love to hear about it as well.
>
>
>###  Code Segments Below   ###
>### Not a complete script  ###
>##--------------------------------------------------------------
>sub Add_Tray {
>
>    $TrayCount++;  ##--> Increment TrayIcon ID#
>    $TIcon = $Window->AddNotifyIcon( -name => "TrayIcon",
>                                     -id => $TrayCount,
>                                     -icon => $Icon,
>                                     -tip => "$tip",
>                                     );
>}
>
> $Window->TrayIcon->Delete(-id => $TrayCount); ##--> Del Tray Icon
> &Add_Tray($cond);      ##--> Create new TrayIcon with updated tips
>
>
>
>
> 
>Monday, March 20, 2000, 11:33:51, you wrote:
>
>HM> This sets the icon correctly to tool.ico:
>HM> my $icon = new Win32::GUI::Icon("tool.ico");
>HM> $trayicon = $Window->AddNotifyIcon(-name => "TrayIcon", -id=>1,-icon => 
$icon, 
>-tip =>> "$title");
>
>HM> Now, I'd like to change the icon based on a timer in the program.  I can 
change
>HM> the window's icon but not the system tray icon.  Is it possible to 
dynamically
>HM> change the system tray icon?
>
>HM> Hoff Miller
>
>
>
>
>-- 
>Best regards,
> Cam                            mailto:[EMAIL PROTECTED]
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Talk to your friends online with Yahoo! Messenger.
>http://im.yahoo.com



Reply via email to