CMonthCalCtrl and localization
Visual C++ 6.0 offers a few new classes. Among these, CDateTimeCtrl and CMonthCalCtrl introduce two new controls: the Date and Time Picker (DTP) control and the Month Calendar control. Since both look very cool I plan to use them in my project. The project I work on is supposed to be deployed in Greece. The good side of both above-mentioned controls is that they can be localized: switch the locale and both controls will display the days and the months in Greek – cool! But because nothing is perfect, there is a down side too. I planed to create my user interface so that it can be switched back and forth between Greek and English at run-time.
As it is explained in the documentation, “the Month Calendar control gets its format and all strings from LOCALE_USER_DEFAULT” (“Month Calendar Control” – MSDN 6.0 – Oct. 99). The LOCALE_USER_DEFAULT, which identifies the locale of the current user, cannot be changed programmatically and keeps all the settings, as they are when the application starts.
Apparently not “all strings” are taken from LOCALE_USER_DEFAULT. I tried to switch from Greek to English and redisplay my Month Calendar control. The result was very strange: the upper part of my control, the one that displays the name of the current month and all the days of week, stayed displayed in Greek. My control was created without the MCS_NOTODAY style applied so that at the bottom it displays today’s date. When I switched to English, today’s date was printed in English: the message was “Today: 21/2/2000”.
Is there a way I can switch ALL the strings for a Month Calendar control back and forth between Greek and English at run-time?