Visual Basic > API and Miscellaneous
Use of the API-call to get currency-format
Use of the API-call to get currency-format 'get format of currency with API call GetLocalInfo Public Const LOCALE_USER_DEFAULT = &H400 Public Const LOCALE_SCURRENCY = &H14 ' local monetary symbol Public Const LOCALE_SINTLSYMBOL = &H15 ' intl monetary symbol Public Const LOCALE_SMONDECIMALSEP = &H16 ' monetary decimal separator Public Const LOCALE_SMONTHOUSANDSEP = &H17 ' monetary thousand separator Public Const LOCALE_SMONGROUPING = &H18 ' monetary grouping Public Const LOCALE_ICURRDIGITS = &H19 ' # local monetary digits 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 ' ' locale specific information ' Public sub GetInfo() dim buffer As String * 100 dim dl& 'compare this with 'Start/Settings/Control Panel/Regional Settings/Currency #If Win32 Then dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, buffer, 99) Form1.list1.AddItem " Local curency symbol: " & LPSTRToVBString(buffer) dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SINTLSYMBOL, buffer, 99) Form1.list1.AddItem " international currency symbol: " & LPSTRToVBString(buffer) dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, buffer, 99) Form1.list1.AddItem " decimaal separator: " & LPSTRToVBString(buffer) dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, buffer, 99) Form1.list1.AddItem " Thousand separator: " & LPSTRToVBString(buffer) dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, buffer, 99) Form1.list1.AddItem " Number of digits in group: " & LPSTRToVBString(buffer) dl& = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, buffer, 99) Form1.list1.AddItem " Number of digits behind the decimal separator: " & LPSTRToVBString(buffer) #Else Form1.list1.AddItem " Not implemented under Win16" #End If End Sub ' ' Extracts a VB string from a buffer containing a null terminated ' string Public Function LPSTRToVBString$(ByVal s$) dim nullpos& nullpos& = InStr(s$, Chr$(0)) If nullpos > 0 Then LPSTRToVBString = Left$(s$, nullpos - 1) Else LPSTRToVBString = "" end If End Function Return
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows