ChangeSysTrayIcon()
Syntax
ChangeSysTrayIcon(#SysTrayIcon, ImageID)Description
Changes the specified icon in the SysTray area.
Parameters
#SysTrayIcon The SysTray icon to change. ImageID The new image to use for the SysTray icon. It is advised to use a PNG image in order to have a transparency layer. ImageID() may be used to get this ID easily.
Return value
None.
Example
; Invisible window to just have the systray
OpenWindow(0, 0, 0, 10, 10, "", #PB_Window_Invisible)
; Create an image with a yellow box to be used for the Systray icon:
If CreateImage(0, 16, 16) And StartDrawing(ImageOutput(0))
Box(0, 0, 16 , 16, $00DDDD)
StopDrawing()
EndIf
; Associate the menu to the systray
AddSysTrayIcon(0, WindowID(0), ImageID(0))
; Create a pop-up menu to be used with the Systray icon later:
CreatePopupImageMenu(0, #PB_Menu_SysTrayLook)
MenuItem(0, "Exit")
SysTrayIconMenu(0, MenuID(0))
AddWindowTimer(0, 0, 1000) ; Add a window timer, which should cause a change of the Systray icon after every 1000 ms
Repeat
Select WaitWindowEvent()
Case #PB_Event_Timer
; Update the Systray icon image with a randomly sized red circle on the yellow background
If StartDrawing(ImageOutput(0))
Box(0, 0, 16 , 16, $00DDDD)
Radius = Random(6, 2)
Circle(8, 8, Radius, $0000DD)
StopDrawing()
ChangeSysTrayIcon(0, ImageID(0))
EndIf
Case #PB_Event_Menu
Select EventMenu()
Case 0 ; Quit after clicking on the 'Exit' menu item associated to the Systray icon
RemoveSysTrayIcon(0)
End
EndSelect
EndSelect
ForEver
See Also
AddSysTrayIcon()
Supported OS
All