JessicaR44
Messages postés116Date d'inscriptionmardi 8 août 2006StatutMembreDernière intervention29 septembre 2013
-
27 nov. 2006 à 22:56
JessicaR44
Messages postés116Date d'inscriptionmardi 8 août 2006StatutMembreDernière intervention29 septembre 2013
-
28 nov. 2006 à 22:13
Bonsoir,
J'aimerais constituer une BDD avec la liste de tous les pays, leur abréviation officielle et leur code. J'ai bien trouvé un exemple qui utilise l'API GetGeoId, mais cela ne fonctionne qu'avec ME, XP ou Server2003. Or, je travaille avec Windows2000.
J'ai donc fait une recherche sur AllAPI.net , qui m'a donné un exemple d'utilisation de l'API GetLocaleInfo.
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
PrivateDeclareFunction GetLocaleInfo Lib"kernel32"Alias"GetLocaleInfoA" (ByVal Locale AsLong, ByVal LCType AsLong, ByVal lpLCData AsString, ByVal cchData AsLong) AsLong
PrivateSub 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
EndSub
PublicFunction GetInfo(ByVal lInfo AsLong) AsString
Dim Buffer AsString, Ret AsString
Buffer = String$(256, 0)
Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))
If Ret > 0 Then
GetInfo = Left$(Buffer, Ret - 1)
Else
GetInfo = ""
EndIf
EndFunction
J'ai essayé de faire une boucle sur LOCALE_USERDEFAULT de &H400 à &H499, mais je ne peux lister que quelques pays (pas tous)
Saudi Arabia SAU 966
Bulgaria BGR 359
Spain ESP 34
Taiwan TWN 886
Czech Republic CZE 420
Denmark DNK 45
Germany DEU 49
Greece GRC 30
United States USA 1
Spain ESP 34
Finland FIN 358
France FRA 33
Israel ISR 972
Hungary HUN 36
Iceland ISL 354
Italy ITA 39
Japan JPN 81
.....
Si quelqu'un avait une idée ...
Merci d'avance
Jessica
JessicaR44
Messages postés116Date d'inscriptionmardi 8 août 2006StatutMembreDernière intervention29 septembre 2013 28 nov. 2006 à 22:13
Eureka !
Pour ceux que ça intéresse, la liste des pays est stockée dans la registry, "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\
CurrentVersion\telephony\Country List"
Et je vais m'autoriser à accepter ma propre réponse !
Jessica
JessicaR44
Messages postés116Date d'inscriptionmardi 8 août 2006StatutMembreDernière intervention29 septembre 2013 28 nov. 2006 à 00:54
Bonsoir,
Non, ce n'est pas ce que je recherche, mais par contre, de liens en liens, tu m'as mise sur une piste que je vais explorer demain et je vous tiens au courant. Je t'en remercie vivement.
Jessica