CMonthCalCtrl::SetFirstDayOfWeek

BOOL SetFirstDayOfWeek( int iDay, int* lpnOld = NULL );

Return Value

Nonzero if the previous first day of the week is set to a value other than that of LOCALE_IFIRSTDAYOFWEEK, which is the day indicated in the control panel setting. Otherwise, this function returns 0.

Parameters

iDay

An integer value representing which day is to be set as the first day of the week. This value must be one of the day numbers. See GetFirstDayOfWeek for a description of the day numbers.

lpnOld

A pointer to an integer indicating the first day of the week previously set.

Remarks

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

Example

void CDatesDlg::OnButton2() 
{
   // This work isn't normally necessary, since the control will set 
   // the day of the week to match the system locale by itself.

   // Ask the system for the first day of the week
   TCHAR sz[2];
   BOOL bResult = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, 
      LOCALE_IFIRSTDAYOFWEEK, sz, 2);

   // Convert from string result
   int nFirstDay = _ttoi(sz);

   // Gain a pointer to the control
   CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetDlgItem(IDC_MONTHCALENDAR1);

   // Set it and assert that it was successful.
   pCtrl->SetFirstDayOfWeek(nFirstDay);
   ASSERT(pCtrl->GetFirstDayOfWeek() == nFirstDay);
}

CMonthCalCtrl OverviewClass MembersHierarchy Chart

See Also   CMonthCalCtrl::GetFirstDayOfWeek