通过 API 函数GetSystemDefaultLCID 判断系统的语言
Option Explicit
Dim lang As String
Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Private Sub Form_Load()
Dim LocaleID As Long
LocaleID = GetSystemDefaultLCID
Select Case LocaleID
Case &H404
MsgBox "当前系统为:中文繁体", , "语言"
Case &H804
MsgBox "当前系统为:中文简体", , "语言"
lang = "1"
Case &H409
MsgBox "当前系统为:英文", , "语言"
lang = "2"
End Select
End Sub
Language Identifiers
A language identifier is a standard international numeric abbreviation for the language in a country or geographical region. Each language has a unique language identifier (LANGID), a 16-bit value that consists of a primary language identifier and a sublanguage identifier. The LANGID is constructed using the MAKELANGID macro. The following illustration shows the format of the bits in a LANGID.
我要的结果应该是如下所示的Identifier:
Identifier Language
0x0000 Language Neutral
0x007f The language for the invariant locale (LOCALE_INVARIANT). See MAKELCID.
0x0400 Process or User Default Language