IMenuButton::AddButton

[This is preliminary documentation and subject to change.]

Enables a user to add a button to the MMC menu bar for a particular view.

HRESULT AddButton(
  int idCommand,  // Specifies a unique user-supplied value
  LPOLESTR lpButtonText
                  // Pointer to the text value for the button
  LPOLESTR lpTooltipText
                  // Pointer to the text value for the button's
                  // tooltip
);
 

Parameters

idCommand
[in] Specifies a user-supplied value that uniquely identifies the button to be added to the menu bar.
lpButtonText
[in] Pointer to the text value (a null-terminated string) to be displayed on the button.
lpTooltipText
[in] Pointer to the text value (a null-terminated string) to be displayed when the user places the mouse pointer on the button.

Return Values

S_OK
The button was successfully added.
E_UNEXPECTED
An unexpected error occurred.

Remarks

Buttons added to the MMC menu bar for a particular view are always appended to the buttons already present. The initial state of a menu button is hidden and disabled.

When the snap-in loses focus, these buttons are automatically removed from the menu bar. As a result, they must be added each time the snap-in gets focus.

This method can be called by primary or extension snap-ins.

See Also

IMenuButton