AddCommandToMenu()

Examples


The AddCommandToMenu function provided by Microsoft Dynamics GP is used to add a command or command list to an existing menu.

Syntax

AddCommandToMenu ParentDictID, ParentFormID, ParentCmdID, Sequence, CmdDictID, CmdFormID, CmdID, CloneCmd, LoadMode;

Parameters

ParentDictID – The ID of the dictionary that contains the command list (menu or submenu) to which the new command will be added. Use the constant DYNAMICS to specify that you are adding items to the Microsoft Dynamics GP main dictionary.

ParentFormID – The resource ID of the command form that contains the definition of the command list to which you are adding a command.

ParentCmdID – The resource ID of the command list to which you are adding a command.

Sequence – An integer variable that can be used to specify the sequence of the item in the command list. The value 0 specifies the command will be added to the end of the list. The actual position of the command will be returned after the command is added.

CmdDictID – The ID of the dictionary that contains the command you are adding.

CmdFormID – The resource ID of the command form that contains the definition of the command you are adding.

CmdID – The resource ID of the command you are adding.

CloneCmd – A boolean parameter. The value true specifies that the command will be added for all users, while the value false specifies that the command will be added for only the current user.

LoadMode – An integer that specifies where the command will be added. The value corresponds to one of the following constants:

[spacer]

Constant

Description

MENULOAD_TOTABLE

The menu items are being added to the default menu set in the syMenuMstr table.

MENULOAD_TOMEMORY

The menu items are being added directly to the menu set displayed in Microsoft Dynamics GP.


Return value

An integer indicating whether the command was added to the menu. The value corresponds to one of the following constants:

[spacer]

Constant

Description

OKAY

The command was successfully added.

DUPLICATE

The command was not added because it already exists.


Comments

When you add your menu items, we recommend that you add them to the end of the menu or submenu. You should also consider using a separator to separate your items from the default items.

To add a separator to a menu, use the following constants to specify the built-in separator command:

[spacer]

Constant

Description

CMD_BUILTINCMD_DICTID

Specifies the ID of the dictionary that contains the separator built-in command.

CMD_BUILTINCMD_FORMID

Specifies the resource ID of the form that defines the separator built-in command.

cmdSeparator

The built-in separator command.



Documentation Feedback