I have replaced the next and previous month buttons by 4 owner-drawn buttons representing previous year, previous month, next year and next month for 2 reasons:
1) pressing the right mouse button for changing the year isn't user friendly in my opinion.
2) Default button behaviour. As it was before pressing the left mouse button over the minus button and moving the mouse away before releasing the button, leaves the minus button in the pressed state.
By making the button owner-drawn, the focus rectangle can be removed since we have to make sure that the focus is always on the window containing the dates.
For this the treatment of the right mouse button has been removed.
Furthermore I have enhanced the keyboard treatment for next and previous day. In case of a VK_RIGHT/VK_LEFT and the current month stays valid, only the changed cells (previous day / current day) need to be repainted instead of the whole window (which avoids the annoying flicker of the window). For this the functions PreviousDay and NextDay now return TRUE in case the month or year has changed.
I have also introduced VK_UP/VK_DOWN and VK_PRIOR/VK_NEXT (cursor up/down, page up/down) which changed the date to the previous/next week and the previous/next month.
The main reason why the WM_KILLFOCUS didn't work, was caused by the use of GetParent()->EnableWindow (FALSE). This has been corrected.
To make the Control Language independent, the Months and Weekdays array are now initialized with the local settings defined in the Control Panel.
It is now possible to set the date before calling the DoModal() function of the dialog including the control. This can be done by either calling the member functions SetDay (was SetDate()), SetMonth and SetYear or by calling the new member function SetDate which accepts 3 integers.
Since I am using Visual C++ 4.2 I alse replaced the false constants by FALSE.