CMFCToolBar::CommandToIndex

 

Returns the index of the button in the toolbar with a specified command ID.

Syntax

int CommandToIndex(
   UINT nIDFind,
   int iIndexFirst=0 
) const;

Parameters

  • [in] nIDFind
    Specifies the command ID.

  • [in] iIndexFirst
    Specifies the initial index to start from.

Return Value

Zero-based index of the toolbar button if the method was successful; -1 if there is no button with the specified ID.

Remarks

A CMFCToolBar Class object maintains an internal list of the buttons on the toolbar. Call this function to retrieve the index of a button in the list given the command ID of the button.

If iIndex is greater than 0, this method ignores any button on the toolbar that has an index less than iIndex.

Requirements

Header: afxtoolbar.h

See Also

CMFCToolBar Class
Hierarchy Chart