Вопрос
Как определить страну?
Ответ
Const LOCALE_USER_DEFAULT = &H400
Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country
Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language
Const LOCALE_SNATIVELANGNAME = &H4 ' native name of language
Const LOCALE_SNATIVECTRYNAME = &H8 ' native name of country
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()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
MsgBox "You live in " & GetInfo(LOCALE_SENGCOUNTRY) & " (" &
GetInfo(LOCALE_SNATIVECTRYNAME) & ")," & vbCrLf & "and you speak " &
GetInfo(LOCALE_SENGLANGUAGE) & " (" & GetInfo(LOCALE_SNATIVELANGNAME) & ").",
vbInformation
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
Хвастунов Михаил
Copyright 2000-2004 Сообщество Чайников
Контактная информация