BCGControlBar Pro for MFC
int CBCGPToolBar::ReplaceButton ( UINT  uiCmd,
const CBCGPToolbarButton button,
BOOL  bAll = FALSE 
)

Replaces a toolbar button with another toolbar button.

Returns
The number of replaced buttons. It returns 0 if a button with the specified by uiCmd command does not exist on the toolbar.

Call this member function to replace a toolbar button with another toolbar button. If the bAll parameter is TRUE, then all buttons located after a button with the uiCmd command will be replaced.

This function is useful when you need to put on a toolbar non-standard buttons that can't be loaded from the resources. Usually, you should reserve dummy toolbar buttons at design time and replace them at the runtime.

Parameters
uiCmdSpecifies the command ID of a button to replace.
buttonA reference to CBCGPToolbarButton - derived object to insert.
bAllIndicates whether to replace all buttons starting from the specified by uiCmd button.