2011-01-02 10 views

答えて

2

私はこの非常にテストされていないスニペット

Private Const LOCALE_SISO639LANGNAME  As Long = &H59 

Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) 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 

Private Sub Command1_Click() 
    MsgBox pvGetUserLocaleInfo(GetKeyboardLayout(0&) And &HFFFF&, LOCALE_SISO639LANGNAME) 
End Sub 

Private Function pvGetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As Long) As String 
    Dim sReturn   As String 
    Dim nSize   As Long 

    nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn)) 
    If nSize > 0 Then 
     sReturn = Space$(nSize) 
     nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn)) 
     If nSize > 0 Then 
     pvGetUserLocaleInfo = Left$(sReturn, nSize - 1) 
     End If 
    End If 
End Function 
を使用しています
関連する問題