CMonthCalCtrl::GetToday

BOOL CMonthCalCtrl::GetToday( COleDateTime& refDateTime ) const;

BOOL CMonthCalCtrl::GetToday( CTime& refDateTime ) const;

BOOL GetToday( LPSYSTEMTIME pDateTime ) const;

Return Value

Nonzero if successful; otherwise 0.

Parameters

refDateTime

A reference to a COleDateTime or CTime object indicating the current day.

pDateTime

A pointer to a SYSTEMTIME structure that will receive the date information. This parameter must be a valid address and cannot be NULL.

Remarks

This member function implements the behavior of the Win32 message MCM_GETTODAY, as described in the Platform SDK.

In MFC's implementation of GetToday, you can specify a COleDateTime usage, a CTime usage, or a SYSTEMTIME structure usage.

Example

void CDatesDlg::OnButton1() 
{
   // Gain a pointer to the control
   CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetDlgItem(IDC_MONTHCALENDAR1);

   COleDateTime timeToday;
   if (pCtrl->GetToday(timeToday))
   {
      // Format the date information from the value we received
      // and post a message box about it.
      CString str = timeToday.Format(VAR_DATEVALUEONLY);
      AfxMessageBox(str);

      // Set the control's "today" indicator to be five
      // days previous.
      timeToday -= 5;
      pCtrl->SetToday(timeToday);
   }
   else
   {
      // Something is wrong!
      ASSERT(FALSE);
   }
}

CMonthCalCtrl OverviewClass MembersHierarchy Chart

See Also   CMonthCalCtrl::SetToday