borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (User Information API)Next Topic (Error 1326 using CreateProcessWithLogonW) New Topic New Poll Post Reply
AndreaVB Forum : API : API and Locale Info...
Poster Message
magikandrea
Level: Big Cheese

Registered: 08-10-2002
Posts: 21

icon API and Locale Info...

Hi,
I've got a program that runs on different computers. I don't know their International Settings, but I would like to know which is the decimal separator used on these computers.
How can I do?
Can I use some API call to determine which is the decimal separator?

Thanks a lot for your help!!!

02-02-2003 at 09:31 PM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: API and Locale Info...

Hello. Am I a bit late?
Anyway, I copy and paste  the tip from a web page I found.

quote:
Get the decimal separator and digit grouping symbol
To obtain the current user's settings for the decimal separator and digit grouping symbol, use the GetLocaleInfo function. You can use the same method to retrieve a slurry of other useful information, such as the names of months and days, language, currency format etc.

Private Const LOCALE_USER_DEFAULT& = &H400
Private Const LOCALE_SDECIMAL& = &HE
Private Const LOCALE_STHOUSAND& = &HF
Private Declare Function GetLocaleInfo& Lib "kernel32" Alias _
    "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
    ByVal lpLCData As String, ByVal cchData As Long)

Private Function ThousandSeparator() As String
  Dim r As Long, s As String
  s = String(10, "a")
  r = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, s, 10)
  ThousandSeparator = Left$(s, r)
End Function

Private Function DecimalSeparator() As String
  Dim r As Long, s As String
  s = String(10, "a")
  r = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, s, 10)
  DecimalSeparator = Left$(s, r)
End Function

The source page is at  this link.
Hope it helps, and sorry for delay.

____________________________
Real Programmer can count up to 1024 on his fingers
06-04-2005 at 04:43 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : API : API and Locale Info...
Previous Topic (User Information API)Next Topic (Error 1326 using CreateProcessWithLogonW) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder