GetLocaleInfoA Subroutine Example
The following example uses the GetLocaleInfoA call to get the decimal separator specified for the local machine. We will also use the API call GetUserDefaultLCID to obtain the default locale of the local user. This gives us the first parameter for GetLocaleInfoA.
Public Function GetDecimalSeparator()
Dim intCountChar As Integer
Dim lngHolder As Long
Dim strDecChar As String
On Error GoTo ErrorHandler
'Set the buffer for the return value
strDecChar = Space$(255)
'Get the decimal separator and the count of characters for the thousand 'separator
lngHolder = GetLocaleInfoA(GetUserDefaultLCID(), LOCALE_SDECIMAL, strDecChar, Len(strDecChar) + 1)
'Now set the return value to just the decimal separator.
GetDecimalSeparator = Left$(strDecChar, lngHolder - 1)
Exit Function
ErrorHandler:
HandleError
End Function