共用方式為


CToolBarCtrl::PressButton

Presses or releases the specified button in a toolbar control.

BOOL PressButton( 
   int nID, 
   BOOL bPress = TRUE  
);

Parameters

  • [in] nID
    Command identifier of the button to press or release.

  • [in] bPress
    true to press the specified button; false to release the specified button. The default value is true.

Return Value

true if the method is successful; otherwise, false.

Remarks

If you want to change more than one button state, consider calling SetState instead.

This method sends the TB_PRESSBUTTON message, which is described in the Windows SDK.

Requirements

Header: afxcmn.h

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

CToolBarCtrl::IsButtonPressed

CToolBarCtrl::EnableButton

CToolBarCtrl::CheckButton

CToolBarCtrl::HideButton

CToolBarCtrl::Indeterminate

CToolBarCtrl::GetState

CToolBarCtrl::SetState