Name
SetTrayIcon -- install brush as a system tray icon (V5.2)
Synopsis
SetTrayIcon(id[, tooltip$, type])
Platforms
Microsoft Windows only

Function
This function can be used to install the image specified in id as an icon in the Windows system tray. Whenever the user clicks on this icon, your script will get an event of type TrayIcon which you can listen to using InstallEventHandler(). The optional argument tooltip$ can be used to specify a string that should be displayed as a tooltip whenever the mouse hovers over the system tray icon.

The image that you pass to this function should be 16x16 pixels and should use an alpha channel for transparency.

In case you have already installed a system tray icon when you call this function, the icon will be changed to the graphics of the specified brush. If you pass the special value #NONE as the brush identifier, the system tray icon will be removed.

Another special value that you can pass to this function is #DEFAULTICON. If you pass #DEFAULTICON in id, SetTrayIcon() will use the icon that has been declared using the @APPICON preprocessor command, or, in case no @APPICON declaration has been made, Hollywood's default icon, the clapperboard.

Starting with Hollywood 8.0 there is an optional type argument which allows you to specify the source image type for the tray icon. This defaults to #BRUSH which means that you have to pass the identifier of a brush in the id argument. However, you can also set the type argument to #ICON, in which case you have to pass the identifier of a Hollywood icon in the id argument. This has the advantage that Hollywood can choose different images depending on the resolution of the host system's monitor. This is very useful for systems using high DPI monitors. By using an icon that contains an image in several resolutions, you can make sure that the tray icon looks perfectly crisp even on high DPI monitors. See CreateIcon for details.

Note that if you pass an icon in id, you have to make sure to set the 16x16 image as the standard image inside the icon because 16x16 pixels is the default icon size for the Windows system tray. See SetStandardIconImage for details.

Inputs
id
identifier of the image to use as system tray icon or #NONE or #DEFAULTICON
tooltip$
optional: text to display as an icon tooltip
type
optional: type of the image passed in id; this can be either #BRUSH or #ICON (defaults to #BRUSH) (V8.0)
Example
InstallEventHandler({TrayIcon = ...})
SetTrayIcon(1, "My program")
The code above enables the tray icon event handler and then installs brush number 1 as a system tray icon.

Show TOC