共用方式為


CToolBarCtrl::CreateEx

Creates a control (a child window) and associates it with the CToolBarCtrl object.

virtual BOOL CreateEx( 
   DWORD dwExStyle, 
   DWORD dwStyle, 
   const RECT& rect, 
   CWnd* pParentWnd, 
   UINT nID  
);

Parameters

  • dwExStyle
    Specifies the extended style of the control being created. For a list of extended Windows styles, see the dwExStyle parameter for CreateWindowEx in the Windows SDK.

  • dwStyle
    Specifies the toolbar control's style. Toolbars must always have the WS_CHILD style. In addition, you can specify any combination of toolbar styles and window styles as described in the Remarks section of Create.

  • rect
    A reference to a RECT structure describing the size and position of the window to be created, in client coordinates of pParentWnd.

  • pParentWnd
    A pointer to the window that is the control's parent.

  • nID
    The control's child-window ID.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Use CreateEx instead of Create to apply extended Windows styles, specified by the Windows extended style preface WS_EX_. CreateEx creates the control with the extended Windows styles specified by dwExStyle. Set extended styles specific to a control using SetExtendedStyle. For example, use CreateEx to set such styles as WS_EX_CONTEXTHELP, but use SetExtendedStyle to set such styles as TBSTYLE_EX_DRAWDDARROWS. For more information, see the styles described in Toolbar Extended Styles in the Windows SDK.

Requirements

Header: afxcmn.h

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

CToolBarCtrl::CToolBarCtrl