Share via


CDateTimeCtrl::GetDateTimePickerInfo

Retrieves information about the current date and time picker control.

BOOL GetDateTimePickerInfo(
     LPDATETIMEPICKERINFO pDateTimePickerInfo
) const;

Parameters

Parameter

Description

[out] pDateTimePickerInfo

A pointer to a DATETIMEPICKERINFO structure that receives a description of the current date and time picker control.

The caller is responsible for allocating this structure. However, this method initializes the cbSize member of the structure.

Return Value

true if this method is successful; otherwise, false.

Remarks

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

Example

The following code example defines the variable, m_dateTimeCtrl, that is used to programmatically access the date and time picker control. This variable is used in the next example.

// Variable to access date-time control.
    CDateTimeCtrl m_dateTimeCtrl;
    // Variable to access the splitbutton control
    CSplitButton m_splitbutton;

The following code example indicates whether it successfully retrieves information about the current date and time picker control.

void CCDateTimeCtrl_s1Dlg::OnXGetdatetimepickerinfo()
{
    // Get information about the date-time picker control.
    DATETIMEPICKERINFO dtpi = {0};
    dtpi.cbSize = sizeof(DATETIMEPICKERINFO);
    BOOL rc = m_dateTimeCtrl.GetDateTimePickerInfo( &dtpi );
    if (rc == TRUE)
        AfxMessageBox(_T("Information retrieved"), 
            MB_ICONEXCLAMATION);
    else 
        AfxMessageBox(_T("Information was not retrieved"));
}

Requirements

Header: afxdtctl.h

This method is supported in Windows Vista and later.

See Also

Reference

CDateTimeCtrl Class

Hierarchy Chart

DTM_GETDATETIMEPICKERINFO

DATETIMEPICKERINFO

Other Resources

CDateTimeCtrl Members