1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Option Explicit
'recuperé sur DVP
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 Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Private Const LOCALE_SDECIMAL = &HE 'séparateur décimal
Dim AsciiLoCaleDecimal As Integer 'mémo du code Ascii du separateur
Private Function ParametreRegional(parametre As Long) As String
Dim lngResultat As Long
Dim buffer As String
Dim pos As Integer
Dim locale As Long
'récupère l'identifiant de l'information locale de type utilisateur
locale = GetUserDefaultLCID()
'renvoie le nombre de caractères nécessaire pour recevoir la valeur du paramètre demandé
lngResultat = GetLocaleInfo(locale, parametre, buffer, 0)
buffer = String(lngResultat, 0)
GetLocaleInfo locale, parametre, buffer, lngResultat
pos = InStr(buffer, Chr(0))
If pos > 0 Then ParametreRegional = Left(buffer, pos - 1)
End Function
Private Sub Form_Load()
AsciiLoCaleDecimal = Asc(ParametreRegional(LOCALE_SDECIMAL))
End Sub |
Partager