2012-05-22 73 views

回答

1

使用WMI它可以做得非常容易:

功能

Public Function GetPropValue(PropName$) As String 
    Dim result$ 
    result = "" 
    Set WMIObjectSet = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT *FROM Win32_OperatingSystem") 
    For Each WMIObject In WMIObjectSet 
     If result <> "" Then 
      Exit For 
     Else 
      For Each WMIProperty In WMIObject.Properties_ 
       If WMIProperty.Name = PropName Then 
        result = WMIProperty.Value 
        Exit For 
       End If 
      Next 
     End If 
    Next 
    GetPropValue = result 
End Function 

可以这样调用:

GetPropValue("OSLanguage") 
1033 

现在必须使用代码页数检查值。详情请访问here

或者

Private Declare Function GetThreadLocale Lib "kernel32"() As Long 

Private Sub Timer1_Timer() 
IF (GetThreadLocale = 1033) Then 
    label1.caption="EN" 
else 
    'check other values 
End IF 
End Sub