Environment: Visual C++ 6/.NET, Windows 95/98/Me/NT/2000/XP
The class CMonthCalCtrlEx
augments its base class CMonthCalCtrl
by the capability to display Sundays and holidays in boldface. If the mouse cursor hovers
above a holiday, its name will be displayed in a tooltip window. Over that the names of special
days which are working days can be displayed in a tooltip window, too (e.g. the
German-American Day, the First Day of Spring etc).
You can easily localize CMonthCalCtrlEx
by supplying a profile HOLIDAYS.INI which
contains a description of all holidays and special days of your country. Two profiles for the USA and the Protestant municipalities of Bavaria,
Germany are added to the source code.
HOLIDAYS.INI contains up to four sections named FixedHolidays, FixedNamedDays,
MovableHolidays, and MovableNamedDays. FixedHolidays and
FixedNamedDays contain the days in the format MMDD=<name>
.
Two examples for FixedHolidays and FixedNamedDays are 1225=Christmas
and 1031=Halloween
. MovableHolidays and MovableNamedDays contain
the days in one or more of the following formats:
MMDD1WD,n-th=<name> | n-th weekday WD before or after a specific date MMDD .WD=1 means Sunday, WD=2 means Monday, and so on.Example for the Protestant Harvest Festival on the first Sunday after September, 29th: 0929+1,1=Harvest Festival |
MM,WD,n-th=<name> | n-th weekday WD of the month MM ,where n-th=5 means the last weekday of the month.WD=1 means Sunday, WD=2 means Monday, and so on.Examples: 11,5,4=Thanksgiving |
A[1NNN]=<name> | 1st Advent or NNN days before or after 1st Advent.Examples: A=1st Advent |
E[1NNN]=<name> | Easter or NNN days before or after Easter.Examples: E=Easter |
SP=<name> | First Day of Spring |
SU=<name> | First Day of Summer |
AU=<name> | First Day of Autumn |
WI=<name> | First Day of Winter |
The calculation of the beginning of the seasons is time-consuming (a lot of double-precision
arithmetic). Therefore once calculated, the result will be stored by
CMonthCalCtrlEx
for further use. CMonthCalCtrlEx
uses
the class CPrivateProfile
which I presented formerly in the section
“Data/Miscellaneous”.
CMonthCalCtrlEx
class members:
Constructors: | |
---|---|
CMonthCalCtrlEx() | Constructs an uninitialized CMonthCalCtrlEx . |
Public member functions: | |
CString GetNameOfDay(COleDateTime& date) | Returns the name(s) of the day specified by date or*pdate . More than one names will be separated by a <CR><LF> sequence. |
void SetHolidaysFromFile(LPCTSTR pszFileName) | Reads all holiday names from the file specified by pszFileName .If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. |