How the date and time picker control is created depends on whether you are using the control in a dialog box or creating it in a nondialog window.
To use CDateTimeCtrl directly in a dialog box
In the dialog editor, add a Date and Time Picker Control to your dialog template resource. Specify its control ID.
Specify any styles required, using the Properties dialog box of the date and time picker control.
Use the Add Member Variable Wizard to add a member variable of type CDateTimeCtrl with the Control property. You can use this member to call CDateTimeCtrl member functions.
In OnInitDialog, set any additional styles for the CDateTimeCtrl object.
To use CDateTimeCtrl in a nondialog window
Declare the control in the view or window class.
Call the control's Create member function, possibly in OnInitialUpdate, possibly as early as the parent window's OnCreate handler function (if you're subclassing the control). Set the styles for the control.
Windows developers have various options for creating applications that run on Windows. This module introduces the native Windows UI frameworks that are available for Windows development. It also provides guidance on how to choose the best framework for your application.