Partager via


CDateTimeCtrl::Create

Creates the date and time picker control and attaches it to the CDateTimeCtrl object.

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

Parameters

  • dwStyle
    Specifies the combination of date time control styles. See Date and Time Picker Control Styles in the Windows SDK for more information about date and time picker styles.

  • rect
    A reference to a RECT structure, which is the position and size of the date and time picker control.

  • pParentWnd
    A pointer to a CWnd object that is the parent window of the date and time picker control. It must not be NULL.

  • nID
    Specifies the date and time picker control's control ID.

Return Value

Nonzero if creation was successful; otherwise 0.

Remarks

To create a date and time picker control

  1. Call CDateTimeCtrl to construct a CDateTimeCtrl object.

  2. Call this member function, which creates the Windows date and time picker control and attaches it to the CDateTimeCtrl object.

When you call Create, the common controls are initialized.

Example

// choose an arbitrary rectangle for creation
CRect rect(20, 20, 120, 45);
m_DateTimeCtrl.Create(WS_VISIBLE | WS_CHILD | WS_TABSTOP | DTS_SHOWNONE | 
   DTS_SHORTDATEFORMAT, rect, this, IDC_DATETIMECTRL);

Requirements

Header: afxdtctl.h

See Also

Reference

CDateTimeCtrl Class

Hierarchy Chart