Attribute VB_Name = "FormLoc"
'Form Localization Utility
'Purpose:  Utility function for VB projects that use forms that display text.  The
'"SetProperFont" function can be used to set the fonts of all text-displaying controls
'to the proper localized font, so a single compiled project can safely be run on
'all supported languages and be able to display the localized characters correctly.


Public szDefaultFont
Private Const MAX_LEADBYTES = 12
Private Const MAX_DEFAULTCHAR = 2
Private Const MAX_PATH = 260

Private Declare Function GetACP Lib "kernel32" () As Long
Private Declare Function GetOEMCP Lib "kernel32" () As Long
Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Private Declare Function GetThreadLocale Lib "kernel32" () As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Declare Function GetLocaleInfo Lib "kernel32" _
      Alias "GetLocaleInfoA" (ByVal Locale As Long, _
      ByVal LCType As Long, ByVal lpLCData As String, _
      ByVal cchData As Long) As Long
    
Public Type CPINFO
    MaxCharSize                     As Long   '  max length (Byte) of a char
    DefaultChar(MAX_DEFAULTCHAR)    As Byte   '  default character
    LeadByte(MAX_LEADBYTES)         As Byte   '  lead byte ranges
End Type

Public Type CPINFOEX
    MaxCharSize                     As Long   '  max length (Byte) of a char
    DefaultChar(MAX_DEFAULTCHAR)    As Byte   '  default character
    LeadByte(MAX_LEADBYTES)         As Byte   '  lead byte ranges
    UnicodeDefaultChar              As String
    CodePage                        As Long
    CodePageName(MAX_PATH)          As String
End Type

Private Declare Function GetCPInfo Lib "kernel32" (ByVal _
        CodePage As Long, lpCPInfo As CPINFO) As Long

Private Declare Function GetCPInfoEx Lib "kernel32" Alias "GetCPInfoExA" (ByVal _
        CodePage As Long, ByVal dwFlags As Long, ByRef lpCPInfoEX As CPINFOEX) As Long

Private Const LOCALE_ICALENDARTYPE = 4105
Private Const LOCALE_SNATIVECTRYNAME = &H8
Private Const LOCALE_IDIGITS = 17
Private Const LOCALE_ILZERO = 18
Private Const LOCALE_STIMEFORMAT = 4099
Private Const LOCALE_STIME = 30
Private Const LOCALE_STHOUSAND = 15
Private Const LOCALE_SSHORTDATE = 31
Private Const LOCALE_SPOSITIVESIGN = 80
Private Const LOCALE_SNEGATIVESIGN = 81
Private Const LOCALE_SNATIVELANGNAME = 4
Private Const LOCALE_SMONGROUPING = 24
Private Const LOCALE_SMONTHOUSANDSEP = 23
Private Const LOCALE_SMONTHNAME9 = 64
Private Const LOCALE_SMONTHNAME8 = 63
Private Const LOCALE_SMONTHNAME7 = 62
Private Const LOCALE_SMONTHNAME6 = 61
Private Const LOCALE_SMONTHNAME5 = 60
Private Const LOCALE_SMONTHNAME4 = 59
Private Const LOCALE_SMONTHNAME3 = 58
Private Const LOCALE_SMONTHNAME2 = 57
Private Const LOCALE_SMONTHNAME12 = 67
Private Const LOCALE_SMONTHNAME11 = 66
Private Const LOCALE_SMONTHNAME10 = 65
Private Const LOCALE_SMONTHNAME1 = 56
Private Const LOCALE_SMONDECIMALSEP = 22
Private Const LOCALE_SLONGDATE = 32
Private Const LOCALE_SLANGUAGE = 2
Private Const LOCALE_SGROUPING = 16
Private Const LOCALE_SDECIMAL = 14
Private Const LOCALE_SDAYNAME7 = 48
Private Const LOCALE_SDAYNAME6 = 47
Private Const LOCALE_SDAYNAME5 = 46
Private Const LOCALE_SDAYNAME4 = 45
Private Const LOCALE_SDAYNAME3 = 44
Private Const LOCALE_SDAYNAME2 = 43
Private Const LOCALE_SDAYNAME1 = 42
Private Const LOCALE_SDATE = 29
Private Const LOCALE_SCURRENCY = 20
Private Const LOCALE_SCOUNTRY = 6
Private Const LOCALE_SENGCOUNTRY = 4098
Private Const LOCALE_SENGLANGUAGE = 4097
Private Const LOCALE_SABBREVMONTHNAME9 = 76
Private Const LOCALE_SABBREVMONTHNAME8 = 75
Private Const LOCALE_SABBREVMONTHNAME7 = 74
Private Const LOCALE_SABBREVMONTHNAME6 = 73
Private Const LOCALE_SABBREVMONTHNAME5 = 72
Private Const LOCALE_SABBREVMONTHNAME4 = 71
Private Const LOCALE_SABBREVMONTHNAME3 = 70
Private Const LOCALE_SABBREVMONTHNAME2 = 69
Private Const LOCALE_SABBREVMONTHNAME13 = 4111
Private Const LOCALE_SABBREVMONTHNAME12 = 79
Private Const LOCALE_SABBREVMONTHNAME11 = 78
Private Const LOCALE_SABBREVMONTHNAME10 = 77
Private Const LOCALE_SABBREVMONTHNAME1 = 68
Private Const LOCALE_SABBREVLANGNAME = 3
Private Const LOCALE_SABBREVDAYNAME7 = 55
Private Const LOCALE_SABBREVDAYNAME6 = 54
Private Const LOCALE_SABBREVDAYNAME5 = 53
Private Const LOCALE_SABBREVDAYNAME4 = 52
Private Const LOCALE_SABBREVDAYNAME3 = 51
Private Const LOCALE_SABBREVDAYNAME2 = 50
Private Const LOCALE_SABBREVDAYNAME1 = 49
Private Const LOCALE_SABBREVCTRYNAME = 7
Private Const LOCALE_ITLZERO = 37
Private Const LOCALE_ITIME = 35
Private Const LOCALE_IPOSSYMPRECEDES = 84
Private Const LOCALE_IPOSSIGNPOSN = 82
Private Const LOCALE_IPOSSEPBYSPACE = 85
Private Const LOCALE_INEGSYMPRECEDES = 86
Private Const LOCALE_INEGSIGNPOSN = 83
Private Const LOCALE_INEGSEPBYSPACE = 87
Private Const LOCALE_INEGCURR = 28
Private Const LOCALE_IMONLZERO = 39
Private Const LOCALE_IMEASURE = 13
Private Const LOCALE_ILDATE = 34
Private Const LOCALE_ILANGUAGE = 1
Private Const LOCALE_IINTLCURRDIGITS = 26
Private Const LOCALE_IDEFAULTLANGUAGE = 9
Private Const LOCALE_IDEFAULTCOUNTRY = 10
Private Const LOCALE_IDEFAULTCODEPAGE = 11
Private Const LOCALE_IDAYLZERO = 38
Private Const LOCALE_IDATE = 33
Private Const LOCALE_ICURRENCY = 27
Private Const LOCALE_ICURRDIGITS = 25
Private Const LOCALE_ICOUNTRY = 5
Private Const LOCALE_ICENTURY = 36
Private Const LOCALE_SYSTEM_DEFAULT = 2048
Private Const LOCALE_USER_DEFAULT = 1024
Private Const LOCALE_INEGNUMBER = 4112

Private Const ANSI_CHARSET = 0
Private Const DEFAULT_CHARSET = 1
Private Const SYMBOL_CHARSET = 2
Private Const SHIFTJIS_CHARSET = 128
Private Const HANGEUL_CHARSET = 129
Private Const HANGUL_CHARSET = 129
Private Const GB2312_CHARSET = 134
Private Const CHINESESIMPLIFIED_CHARSET = 134
Private Const CHINESEBIG5_CHARSET = 136
Private Const OEM_CHARSET = 255
Private Const JOHAB_CHARSET = 130
Private Const HEBREW_CHARSET = 177
Private Const ARABIC_CHARSET = 178
Private Const GREEK_CHARSET = 161
Private Const TURKISH_CHARSET = 162
Private Const VIETNAMESE_CHARSET = 163
Private Const THAI_CHARSET = 222
Private Const EASTEUROPE_CHARSET = 238
Private Const RUSSIAN_CHARSET = 204

Public Sub SetProperFont(obj As Object)
    'On Error GoTo ErrorSetProperFont
    
    With obj
        .Size = 8
        .Name = "Microsoft Sans Serif"
        
        Select Case GetUserDefaultLCID()
            Case &H41A  '// Croatia (Croatian)
                .Charset = EASTEUROPE_CHARSET
            Case &H424  '// Slovenia (Slovenian)
                .Charset = EASTEUROPE_CHARSET
            Case &H41B  '// Slovakia (Slovak)
                .Charset = EASTEUROPE_CHARSET
            Case &H418  '// Romania (Romanian)
                .Charset = EASTEUROPE_CHARSET
            Case &H40E  '// Hungary (Hungarian)
                .Charset = EASTEUROPE_CHARSET
            Case &H415  '// Poland (Polish)
                .Charset = EASTEUROPE_CHARSET
            Case &H405  '// Czechoslovakia
                .Charset = EASTEUROPE_CHARSET
            Case &H42A  '// Vietnam (Vietnamese)
                .Charset = VIETNAMESE_CHARSET
            Case &H41F  '// Turkey (Turkish)
                .Charset = TURKISH_CHARSET
            Case &H408  '// Greek (Greece)
                .Charset = GREEK_CHARSET
            Case &H41E  '// Thailand (Tha)
                .Charset = THAI_CHARSET
            Case &H419  '// Russia (Russian)
                .Charset = EASTEUROPE_CHARSET
            Case &H419  '// Russia (Russian)
                .Charset = RUSSIAN_CHARSET
            Case &H401  ' Saudi Arabia (Arabic)
                .Charset = ARABIC_CHARSET
            Case &H40D  ' Israel (Hebrew)
                .Charset = HEBREW_CHARSET
            Case &H804  ' Simplified Chinese  (People's Republic of China)
                .Charset = CHINESESIMPLIFIED_CHARSET
                .Name = ChrW(&H5B8B) + ChrW(&H4F53)
                .Size = 9
            Case &H404  ' Traditional Chinese (Taiwan)
                .Charset = CHINESEBIG5_CHARSET
                .Name = ChrW(&H65B0) + ChrW(&H7D30) + ChrW(&H660E) + ChrW(&H9AD4)   'New Ming-Li
                .Size = 9
            Case &H411  ' Japan
                .Charset = SHIFTJIS_CHARSET
                .Name = ChrW(&HFF2D) + ChrW(&HFF33) + ChrW(&H20) + ChrW(&HFF30) + ChrW(&H30B4) + ChrW(&H30B7) + ChrW(&H30C3) + ChrW(&H30AF)
                .Size = 9
            Case &H412  ' Korea
                .Charset = HANGEUL_CHARSET
                .Name = ChrW(&HAD74) + ChrW(&HB9BC)
                .Size = 9
            Case Else   ' Default Character Sets
                .Charset = DEFAULT_CHARSET
        End Select
                
        Exit Sub
    End With
'ErrorSetProperFont:
    'Err.Number = Err
End Sub

Private Function GetLocaleObject(oProp) As String
   Dim Symbol As String
   Dim iRet1 As Long
   Dim iRet2 As Long
   Dim lpLCDataVar As String
   Dim Pos As Integer
   Dim Locale As Long
   
   Locale = GetUserDefaultLCID()
   iRet1 = GetLocaleInfo(Locale, oProp, lpLCDataVar, 0)
   
   Symbol = String$(iRet1, 0)
   iRet2 = GetLocaleInfo(Locale, oProp, Symbol, iRet1)
   Pos = InStr(Symbol, Chr$(0))
   If Pos > 0 Then
      Symbol = Left$(Symbol, Pos - 1)
   End If
   
   GetLocaleObject = Symbol
End Function

Public Function GetCountryLocale() As String
   GetCountryLocale = GetLocaleObject(LOCALE_SENGCOUNTRY)
End Function

Public Function UpdateLangDialog()
    Dim iCount As Integer
    SetProperFont frmLang.frmCountry.Font
    SetProperFont frmLang.lvLangData.Font
    SetProperFont frmLang.Font
    
    frmLang.frmCountry.Caption = GetCountryLocale()
    
    Dim LCID As Long, sLcid As String
    LCID = GetThreadLocale() 'Get Current locale
    sLcid = Hex$(Trim$(CStr(LCID))) 'Convert to Hex
    Dim lvItem As ListItem
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "LCID")
    lvItem.ListSubItems.Add 1, , LCID & " (" & sLcid & ")"
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "System CodePage")
    lvItem.ListSubItems.Add 1, , "[" & CStr(GetACP()) & "] " & GetCodePageName(GetACP())
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "OEM CodePage")
    lvItem.ListSubItems.Add 1, , "[" & CStr(GetOEMCP()) & "] " & GetOEMCodePageName(GetOEMCP())
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Default Font")
    lvItem.ListSubItems.Add 1, , szDefaultFont
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Current Font")
    lvItem.ListSubItems.Add 1, , frmViewer.Font.Name
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Country Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SENGCOUNTRY)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Native Country Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SNATIVECTRYNAME)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Localized Country Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SCOUNTRY)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Country Code")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_ICOUNTRY)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Language Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SENGLANGUAGE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Native Language Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SNATIVELANGNAME)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Localized Language Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SLANGUAGE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Abbreviated Language Name")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SABBREVLANGNAME)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Language Identifier")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_ILANGUAGE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Default ANSI CodePage")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_IDEFAULTANSICODEPAGE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Default CodePage")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_IDEFAULTCODEPAGE)
     
      
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Time Format")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_STIMEFORMAT)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Short Date Format")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SSHORTDATE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Long Date Format")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_SLONGDATE)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "AM \ PM Designator")
    lvItem.ListSubItems.Add 1, , GetLocaleObject(LOCALE_S1159) & " \ " & GetLocaleObject(LOCALE_S2359)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Calendar Type")
    Select Case CInt(GetLocaleObject(LOCALE_ICALENDARTYPE))
        Case 1:
            lvItem.ListSubItems.Add 1, , "Gregorian (as in United States)"
        Case 2:
            lvItem.ListSubItems.Add 1, , "Gregorian (English strings always)"
        Case 3:
            lvItem.ListSubItems.Add 1, , "Era: Year of the Emperor (Japan)"
        Case 4:
            lvItem.ListSubItems.Add 1, , "Era: Year based on the Chinese Calendar"
        Case 5:
            lvItem.ListSubItems.Add 1, , "Tangun Era(Korea)"
    End Select
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Monday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME1) & ")     " & GetLocaleObject(LOCALE_SDAYNAME1)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Tuesday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME2) & ")     " & GetLocaleObject(LOCALE_SDAYNAME2)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Wednesday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME3) & ")     " & GetLocaleObject(LOCALE_SDAYNAME3)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Thursday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME4) & ")     " & GetLocaleObject(LOCALE_SDAYNAME4)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Friday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME5) & ")     " & GetLocaleObject(LOCALE_SDAYNAME5)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Saturday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME6) & ")     " & GetLocaleObject(LOCALE_SDAYNAME6)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "Sunday")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVDAYNAME7) & ")     " & GetLocaleObject(LOCALE_SDAYNAME7)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "January")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME1) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME1)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "February")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME2) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME2)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "March")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME3) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME3)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "April")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME4) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME4)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "May")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME5) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME5)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "June")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME6) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME6)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "July")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME7) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME7)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "August")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME8) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME8)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "September")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME9) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME9)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "October")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME10) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME10)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "November")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME11) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME11)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "December")
    lvItem.ListSubItems.Add 1, , "(" & GetLocaleObject(LOCALE_SABBREVMONTHNAME12) & ")" & "    " & GetLocaleObject(LOCALE_SMONTHNAME12)
    
    Set lvItem = frmLang.lvLangData.ListItems.Add(frmLang.lvLangData.ListItems.count + 1, , "")
    lvItem.ListSubItems.Add 1, , ""
End Function

Function GetCharSet(sCdpg As String) As Integer
   Select Case sCdpg
      Case "932" ' Japanese
         GetCharSet = 128
      Case "936" ' Simplified Chinese
         GetCharSet = 134
      Case "949" ' Korean
         GetCharSet = 129
      Case "950" ' Traditional Chinese
         GetCharSet = 136
      Case "1250" ' Eastern Europe
         GetCharSet = 238
      Case "1251" ' Russian
         GetCharSet = 204
      Case "1252" ' Western European Languages
         GetCharSet = 0
      Case "1253" ' Greek
         GetCharSet = 161
      Case "1254" ' Turkish
         GetCharSet = 162
      Case "1255" ' Hebrew
         GetCharSet = 177
      Case "1256" ' Arabic
         GetCharSet = 178
      Case "1257" ' Baltic
         GetCharSet = 186
      Case Else
         GetCharSet = 0
   End Select
End Function

Private Function GetCodePageName(cp As Long) As String
    Select Case cp
        Case 874:
            GetCodePageName = "Thai"
        Case 932:
            GetCodePageName = "Japan"
        Case 936:
            GetCodePageName = "Chinese (PRC, Singapore)"
        Case 949:
            GetCodePageName = "Korean"
        Case 950:
            GetCodePageName = "Chinese (Taiwan; Hong Kong SAR, PRC)"
        Case 1200:
            GetCodePageName = "Unicode (BMP of ISO 10646)"
        Case 1250:
            GetCodePageName = "Windows 3.1 Eastern European"
        Case 1251:
            GetCodePageName = "Windows 3.1 Cyrillic"
        Case 1252:
            GetCodePageName = "Windows 3.1 Latin 1 (US, Western Europe)"
        Case 1253:
            GetCodePageName = "Windows 3.1 Greek"
        Case 1254:
            GetCodePageName = "Windows 3.1 Turkish"
        Case 1255:
            GetCodePageName = "Hebrew"
        Case 1256:
            GetCodePageName = "Arabic"
        Case 1257:
            GetCodePageName = "Baltic"
        Case Else
            GetCodePageName = "Unknown Code Page"
    End Select
End Function

Private Function GetOEMCodePageName(cp As Long) As String
    Select Case cp
        Case 437:
            GetOEMCodePageName = "MS-DOS United States"
        Case 708:
            GetOEMCodePageName = "Arabic (ASMO 708)"
        Case 709:
            GetOEMCodePageName = "Arabic (ASMO 449+, BCON V4)"
        Case 710:
            GetOEMCodePageName = "Arabic (Transparent Arabic)"
        Case 720:
            GetOEMCodePageName = "Arabic (Transparent ASMO)"
        Case 737:
            GetOEMCodePageName = "Greek (formerly 437G)"
        Case 775:
            GetOEMCodePageName = "Baltic"
        Case 850:
            GetOEMCodePageName = "MS-DOS Multilingual (Latin I)"
        Case 852:
            GetOEMCodePageName = "MS-DOS Slavic (Latin II)"
        Case 855:
            GetOEMCodePageName = "IBM Cyrillic (primarily Russian)"
        Case 857:
            GetOEMCodePageName = "IBM Turkish"
        Case 860:
            GetOEMCodePageName = "MS-DOS Portuguese"
        Case 861:
            GetOEMCodePageName = "MS-DOS Icelandic"
        Case 862:
            GetOEMCodePageName = "Hebrew"
        Case 863:
            GetOEMCodePageName = "MS-DOS Canadian-French"
        Case 864:
            GetOEMCodePageName = "Arabic"
        Case 865:
            GetOEMCodePageName = "MS-DOS Nordic"
        Case 866:
            GetOEMCodePageName = "MS-DOS Russian (former USSR)"
        Case 869:
            GetOEMCodePageName = "IBM Modern Greek"
        Case 874:
            GetOEMCodePageName = "Thai"
        Case 932:
            GetOEMCodePageName = "Japan"
        Case 936:
            GetOEMCodePageName = "Chinese (PRC, Singapore)"
        Case 949:
            GetOEMCodePageName = "Korean"
        Case 950:
            GetOEMCodePageName = "Chinese (Taiwan; Hong Kong SAR, PRC)"
        Case 1361:
            GetOEMCodePageName = "Korean (Johab)"
        Case Else:
            GetOEMCodePageName = "Unknown OEM Code Page"
    End Select
End Function


