The Locale Explorer: GetCalendarInfo, EnumCalendarInfo, EnumCalendarInfoEx

Home
Back To Tips Page

Back to LocaleExplorer

In addition to demonstrating EnumCalendarInfo, EnumCalendarInfoEx and GetCalendarInfo, this also demonstrates handling changing edit control backgrounds, and using international fonts.

To use this page, first select a Call Type, such as EnumCalendarInfo, EnumCalendarInfoEx, or GetCalendarInfo.  Then select a CALID parameter.  Then select a CALTYPE parameter by clicking in the value field.  What will appear is the code window is the required code.

In the above example, the entire code window contents are

//static BOOL CALLBACK EnumCalendarInfoProc(LPTSTR); // add this to your class definition
BOOL CALLBACK EnumCalendarInfoProc(LPTSTR info)
   {
    // use info, which is a string for CAL_ITWODIGITYEARMAX, here
    return TRUE; // continue enumeration
   } // EnumCalendarInfoProc

LCID lcid = MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT);
if(!::EnumCalendarInfo(EnumCalendarInfoProc, lcid, ENUM_ALL_CALENDARS, CAL_RETURN_NUMBER | CAL_ITWODIGITYEARMAX))
   { /* error */
    DWORD err = ::GetLastError();
    // .. handle error here
   } /* error */

In the implementation, the callback method adds each of the strings delivered to the callback to the CListCtrl so the two values shown are for the weekday name in each of the two calendars supported.

[Dividing Line Image]

The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.

Send mail to newcomer@flounder.com with questions or comments about this web site.
Copyright © 2005 Joseph M. Newcomer/FlounderCraft Ltd.  All Rights Reserved.
Last modified: May 14, 2011