共用方式為


CToolBarCtrl::SetCmdID

Sets the command identifier that will be sent to the owner window when the specified button is pressed.

BOOL SetCmdID(
   int nIndex,
   UINT nID 
);

Parameters

  • nIndex
    The zero-based index of the button whose command ID is to be set.

  • nID
    The command ID to set the selected button to.

Return Value

Returns nonzero if successful; otherwise zero.

Requirements

Header: afxcmn.h

See Also

Concepts

CToolBarCtrl Class

CToolBarCtrl Members

Hierarchy Chart

CToolBarCtrl::CommandToIndex

CToolBarCtrl::GetButton

CToolBarCtrl::AddButtons

CToolBarCtrl::InsertButton