1 頁 (共 1 頁)

如何取得系統語系及國別

發表於 : 2010年 8月 11日, 10:58
tim
可以利用API GetLocaleInfo 來取得相關資訊, 範例程式如下:

語法:

代碼: 選擇全部

     
    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 form_Load() 
        MsgBox GetInfo(&H1002) 
        MsgBox GetInfo(&H8) 
        MsgBox GetInfo(&H1001) 
        MsgBox GetInfo(&H4) 
    End Sub 
     
    Public Function GetInfo(ByVal lInfo As Long) As String 
        Dim Buffer As String, Ret As String 
        Buffer = String$(256, 0) 
        Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer)) 
        If Ret > 0 Then 
            GetInfo = Left$(Buffer, Ret - 1) 
        Else 
            GetInfo = "" 
        End If 
    End Function 





API用法:
http://msdn.microsoft.com/library/defau ... s_34rz.asp
LCTYPE常數:
http://msdn.microsoft.com/library/defau ... s_8rse.asp
藍色小舖討論:
http://www.blueshop.com.tw/board/show.a ... 5F&fumcde=