Mais ChangeSysTrayIcon ne semble pas fonctionner sous 2000 et 98 car je vient de tester une application sous ses OS et l'icone ne change pas.
A confirmer donc

Code : Tout sélectionner
Enumeration
#Menu
#MenuMute
#MenuExit
EndEnumeration
ExtractIconEx_("sndrec32.exe", 0, #Null, @Icon1.l, 1)
ExtractIconEx_("sndvol32.exe", 3, #Null, @Icon2.l, 1)
OpenWindow(0, 0, 0, 0, 0, #PB_Window_Invisible, "")
AddSysTrayIcon(0, WindowID(), Icon1)
CreatePopupMenu(#Menu)
MenuItem(#MenuMute, "Mute")
MenuBar()
MenuItem(#MenuExit, "Exit")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Menu
Menu = EventMenuID()
If Menu = #MenuMute
State = GetMenuItemState(#Menu, #MenuMute)
If State
Icon = Icon1
Else
Icon = Icon2
EndIf
ChangeSysTrayIcon(0, Icon)
SetMenuItemState(#Menu, #MenuMute, (State+1)&1)
EndIf
ElseIf EventType() = #PB_EventType_LeftClick
DisplayPopupMenu(#Menu, WindowID(), DesktopMouseX(), DesktopMouseY())
EndIf
Until Menu = #MenuExit