# InstallMenuDimmerCallback

int InstallMenuDimmerCallback (int menuBarHandle, MenuDimmerCallbackPtr dimmerFunction);

## Purpose

Installs a menu dimmer callback for a specific menu bar.

InstallMenuDimmerCallback takes the handle of a menu bar and the name of the callback function of type MenuDimmerCallbackPtr.

LabWindows/CVI invokes your menu dimmer callback after the user clicks a menu name on the menubar and before the menu appears. The dimmer function receives the menu bar handle and the handle of the panel on which the menu bar resides for processing. This callback is useful for checking a the state of a program and then dimming invalid menu items before the menu appears. LabWindows/CVI also invokes your menu dimmer callback when the user presses a shortcut key for any menu item in the menubar. If your menu dimmer callback dims the menu item or the item is already dim, LabWindows/CVI does not generate a commit event for the menu item.

Callbacks are initiated through RunUserInterface or GetUserEvent.

| Note To uninstall the callback, pass NULL for dimmerFunction.

## Parameters

Input
Name | Type | Description
menuBarHandle | integer | Specifier for a particular menu bar that is currently in memory. You obtain this handle from LoadMenuBar or NewMenuBar. If the menu bar was automatically loaded through LoadPanel, use GetPanelMenuBar to get the menu bar handle.
dimmerFunction | MenuDimmerCallbackPtr | Name of the menu dimmer callback function. The callback function of type MenuDimmerCallbackPtr takes the following form: void CVICALLBACK DimmerFunctionName (int menuBarHandle, int panelHandle); The dimmer function receives the menu bar handle and the handle of the panel on which the menu bar resides.
| Note To uninstall the callback, pass NULL for this parameter.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success