다음을 통해 공유


CMonthCalCtrl::GetRange

Month calendar 컨트롤에 설정 현재 최소 및 최대 날짜를 검색 합니다.

DWORD GetRange( 
   COleDateTime* pMinRange, 
   COleDateTime* pMaxRange  
) const; 
DWORD GetRange( 
   CTime* pMinRange, 
   CTime* pMaxRange  
) const; 
DWORD GetRange( 
   LPSYSTEMTIME pMinRange, 
   LPSYSTEMTIME pMaxRange  
) const;

매개 변수

  • pMinRange
    에 대 한 포인터는 COleDateTime 개체는 CTime 개체 또는 SYSTEMTIME 범위의 낮은 끝 날짜를 포함 하는 구조.

  • pMaxRange
    에 대 한 포인터는 COleDateTime 개체는 CTime 개체 또는 SYSTEMTIME 높은 범위 끝에 날짜를 포함 하는 구조.

반환 값

A DWORD 0이 될 수 있습니다 (제한이 설정 되어 있음) 또는 제한 정보를 지정한 다음 값의 조합입니다.

의미

GDTR_MAX

컨트롤에 대 한 최대 제한입니다. pMaxRange유효 하며 해당 날짜 정보가 들어 있습니다.

GDTR_MIN

컨트롤에 대 한 최소 제한 됩니다. pMinRange유효 하며 해당 날짜 정보가 들어 있습니다.

설명

이 멤버 함수는 Win32 메시지의 동작을 구현 MCM_GETRANGE에 설명 된 대로, 여 Windows SDK. MFC의 구현에 GetRange, 지정할 수 있습니다는 COleDateTime 사용은 CTime 사용 또는 SYSTEMTIME 구조를 사용 합니다.

예제

// This code fragment sets a variety of ranges in the 
// control, and calls a separate function to show the 
// set range to the user. 

void CMonthCalDlg::OnBnClickedRangebutton()
{
   // set minimum of January 1st, 1995 with no maximum
   COleDateTime dtMin;
   COleDateTime dtMax;

   dtMin = COleDateTime(1995, 1, 1, 0, 0, 0);
   dtMax.SetStatus(COleDateTime::null);
   m_calCtrl1.SetRange(&dtMin, &dtMax);
   ShowRange(&m_calCtrl1);

   // set no minimum and a maximum of September 30th, 1997
   dtMin.SetStatus(COleDateTime::null);
   dtMax = COleDateTime(1997, 9, 30, 0, 0, 0);
   m_calCtrl1.SetRange(&dtMin, &dtMax);
   ShowRange(&m_calCtrl1);

   // set minimum of April 15, 1992 and maximum of June 5, 2002
   dtMin = COleDateTime(1992, 4, 15, 0, 0, 0);
   dtMax = COleDateTime(2002, 6, 5, 0, 0, 0);
   m_calCtrl1.SetRange(&dtMin, &dtMax);
   ShowRange(&m_calCtrl1);
}

void CMonthCalDlg::ShowRange(CMonthCalCtrl* pMoCalCtrl)
{
   ASSERT(pMoCalCtrl != NULL);
   CString strMessage;
   COleDateTime dtMinimum;
   COleDateTime dtMaximum;

   // Get the range
   DWORD dwResult = pMoCalCtrl->GetRange(&dtMinimum, &dtMaximum);

   // If a minimum was specified, format it 
   // otherwise, indicate that there is no lower bound 
   if (dwResult & GDTR_MIN)
      strMessage += dtMinimum.Format(_T("Minimum range is %x %X.\r\n"));
   else
      strMessage += _T("No minimum range.\r\n");

   // Treat maximum similarly 
   if (dwResult & GDTR_MAX)
      strMessage += dtMaximum.Format(_T("Maximum range is %x %X.\r\n"));
   else
      strMessage += _T("No maximum range.\r\n");

   // Show the user
   AfxMessageBox(strMessage);
}

요구 사항

헤더: afxdtctl.h

참고 항목

참조

CMonthCalCtrl 클래스

계층 구조 차트

CMonthCalCtrl::SetRange