Export (0) Print
Expand All


Creates a tab control and attaches it to an instance of a CTabCtrl object.

virtual BOOL Create(
  DWORD dwStyle,
  const RECT& rect,
  CWnd* pParentWnd,



Specifies the tab control's style. Apply any combination of tab control styles, described in the Platform SDK. See Remarks for a list of window styles that you can also apply to the control.


Specifies the tab control's size and position. It can be either a CRect object or a RECT structure.


Specifies the tab control's parent window, usually a CDialog. It must not be NULL.


Specifies the tab control's ID.

TRUE if initialization of the object was successful; otherwise FALSE.

You construct a CTabCtrl object in two steps. First, call the constructor, and then call Create, which creates the tab control and attaches it to the CTabCtrl object.

In addition to tab control styles, you can apply the following window styles to a tab control:

  • WS_CHILD   Creates a child window that represents the tab control. Cannot be used with the WS_POPUP style.

  • WS_VISIBLE   Creates a tab control that is initially visible.

  • WS_DISABLED   Creates a window that is initially disabled.

  • WS_GROUP   Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins).

  • WS_TABSTOP    Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style.

To create a tab control with extended window styles, call CTabCtrl::CreateEx instead of Create.

// Assuming you have a member variable m_pTabCtrl, that is a CTabCtrl
// pointer, you can use the following to create a tab control.

   &rect, this, 0x1006);

// This creates a tab control with the given styles, and with
// an ID of 0x1006.

Community Additions

© 2014 Microsoft