InsertTrayIconMenuItem
int InsertTrayIconMenuItem (int iconHandle, const char itemName[], int *itemIndex);
Purpose
This function adds an item to the specified icon's right–click popup menu. Items are added in order, with the first item being item 1, and grow vertically on the popup menu.
The Callback Function specified in InstallSysTrayIcon will receive EVENT_MENU_ITEM events when the user selects a menu item. eventData will contain the 1–based index of the selected item. The callback function will receive EVENT_RIGHT_CLICK events before any associated popups are diplayed. If you return non–zero from the callback function upon receiving these events, the popup menu will not be displayed.
See the Class Help for more information about the recommended usage of System Tray icons and their popup menus.
(Linux) This function is not supported.
Parameters
Input | ||
Name | Type | Description |
iconHandle | int | The handle of the System Tray icon for which you wish to add a a popup menu item. This handle will have been returned from InstallSysTrayIcon. |
itemName | const char[] | A NULL–terminated string indicating the name of the popup menu item. This is the name which will appear on the popup menu. If you pass NULL, then the created item will be a separator, for which you will not receive events. |
Output | ||
Name | Type | Description |
itemIndex | int | The 1–based index of the newly inserted item. |
Return Value
Name | Type | Description |
status | int | The status code that the function returns. 0 indicates success. A negative value indicates an error. This function may return a Programmer's Toolbox or UI Library error code. Call GetGeneralErrorString to obtain a text description of the error. |
Additional Information
Library: Programmer's Toolbox
Include file: toolbox\toolbox.h
LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later
Example
Refer to toolbox\trayicon.cws for an example of using the InsertTrayIconMenuItem function.