Share via


CMonthCalCtrl::SetFirstDayOfWeek

Sets the day of week to be displayed in the leftmost column of the calendar.

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

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.

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.

Remarks

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

Example

// 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];
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, sz, 2);

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

// Set it and assert that it was successful.
m_calCtrl1.SetFirstDayOfWeek(nFirstDay);
ASSERT(m_calCtrl1.GetFirstDayOfWeek() == nFirstDay);

Requirements

Header: afxdtctl.h

See Also

Reference

CMonthCalCtrl Class

Hierarchy Chart

CMonthCalCtrl::GetFirstDayOfWeek