For an application that might be used in any country, is there somehow I can find out the user's country ?
Printable View
For an application that might be used in any country, is there somehow I can find out the user's country ?
the only way you would know is to access their regional and language settings on their computer. unless you coded your app to ask them to specify which country they were in, and then based on that selection do what you need to.Quote:
Originally Posted by RobertLees
Adapt this example from ALLAPI.net:
VB Code:
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: [url]http://www.allapi.net/[/url] 'E-Mail: [email][email protected][/email] 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
If they have an internetconnection then you could use their ip adress to determine where they are.
which is not always right anywayQuote:
If they have an internetconnection then you could use their ip adress to determine where they are.
true :)Quote:
Originally Posted by westconn1