Change language for calendar control in VB6

I have code written in VB6 and C++ that I cannot upgrade or change to .net.  We are currently using the DTPicker for our calendar control.  Our customers use a variety of codepages as their default, but we need to return the Month within the date in a specific language (not their local codepage).  Is there any way I can write code to force the Month to be returned in a specific language?  For example, our customer is using the Ukranian codepage, but we need to return the month in the Russian codepage language.  We would prefer not to use a different calendar control if possible.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jadixon04Author Commented:
Upon further research we have found that our code is using different types of calendar controls between the VB and C++, with different processing built around some of the C++.  We cannot use any different types of controls, so we cannot use the suggested tools.  I will close this question since we must regroup and determine how we will deal with the different controls.
I don't think you need new controls. Just format the return value from DtPicker as follows:

The return value from DTPicker is actually a Vb Double.
Thus you can use this value to get the Month Name (either abbreviated or full) for any language by specifyinbg the LCID in the following code:

Private Sub DTPicker1_Change()
    lblEnglish.Caption = GetMonthName(DTPicker1.Value, 1033, False)
    lblRussian.Caption = GetMonthName(DTPicker1.Value, 1049, False)
    lblFrench.Caption = GetMonthName(DTPicker1.Value, 1036, False)
End Sub

'In module
Option Explicit
Private Const LOCALE_SMONTHNAME1  As Long = &H38
Private Const LOCALE_SABBREVMONTHNAME1  As Long = &H44
Private Declare Function GetLocaleInfoA Lib "kernel32" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Public Function GetMonthName(ByVal dat As Date, ByVal LCID As Long, ByVal bAbbreviated As Boolean)
   Dim Buffer     As String * 255
   GetLocaleInfoA LCID, Month(dat) - 1 + IIf(bAbbreviated, LOCALE_SABBREVMONTHNAME1, LOCALE_SMONTHNAME1), Buffer, 255
   GetMonthName = StripNull(Buffer)
End Function
Private Function StripNull(ByVal StrIn As String) As String
   Dim nul              As Long
   nul = InStr(StrIn, vbNullChar)
   Select Case nul
      Case Is > 1
         StripNull = Left$(StrIn, nul - 1)
      Case 1
         StripNull = ""
      Case 0
         StripNull = Trim$(StrIn)
   End Select
End Function

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jadixon04Author Commented:
This has helped set me on a track to possibly finding a solution for part of my problem. I think it will require more research and work, but I have a higher priority project at the moment (unfortunately).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.