SysTrayIconMenu()
Syntax
SysTrayIconMenu(#SysTrayIcon, MenuID)Description
Associates the specified popup menu with the SysTray icon. The menu should be created with CreatePopupImageMenu() using the #PB_Menu_SysTrayLook flag. It's the best way to associate a popup menu with a SysTray icon as it will display the popup menu at the correct position on all OS when the user click on the icon.
Parameters
#SysTrayIcon The systray icon to use. MenuID The popup menu to associate with the SysTray. MenuID() can be used to get this value.
Return value
None.
Example
; Invisible window to just have the systray OpenWindow(0, 0, 0, 10, 10, "", #PB_Window_Invisible) UsePNGImageDecoder() AddSysTrayIcon(0, WindowID(0), LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png")) ; Create a pop-up menu to be displayed by the systray with a systray look CreatePopupImageMenu(0, #PB_Menu_SysTrayLook) MenuItem(0, "About PureBasic...") MenuBar() MenuItem(1, "Exit") ; Associate the menu to the systray SysTrayIconMenu(0, MenuID(0)) Repeat Select WaitWindowEvent() Case #PB_Event_Menu Select EventMenu() Case 1 ; Exit RemoveSysTrayIcon(0) End EndSelect EndSelect ForEver
See Also
CreatePopupImageMenu()
Supported OS
All