Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

API Functions

Using GetLocaleInfoEx to get the regional setings for currency by vgulielmus
Posted: 14 Jun 15

GetLocaleInfo and GetLocaleInfoEx can be used to get the local settings for currencies (the ones from Control Panel -> Regional Settings)

Both GetLocaleInfo and GetLocaleInfoEx gives plenty of information. They can be invoked similarly, and gives similar results.
The main difference between the the functions signature is the first parameter. GetLocaleInfo have a LONG parameter, while GetLocaleInfoEx a character parameter.

GetLocaleInfo can be used in Windows XP, Vista and above. GetLocaleInfo tends to become deprecated.
GetLocaleInfoEx can be used in Windows Vista and above, but cannot be used in Windows XP.

GetLocaleInfo provide ASCII results, while GetLocaleInfoEx supports Unicode.
This means many currencies (like English India) can be obtained only with GetLocaleInfoEx.

To get the values for the default settings, the first parameter of GetLocaleInfoEx must be Null.
For other values, use the format <language> - <REGION>, but converted to Unicode
For example
StrConv ("en-AU", 5) + CHR (0)
StrConv ("en-US", 5) + CHR (0)

CODE --> Foxpro

Declare INTEGER GetLocaleInfoEx in Win32API String Locale, LONG LCType, STRING @LpLCData, INTEGER cchData

LOCAL LpLCData,cchData,nretval,LPCWSTR
LpLCData = space(255)
cchData = LEN(LpLCData)
nretval = 0

? "get the currency symbol for user default"
nretval = GetLocaleInfoEx(LPCWSTR, 0x14, @LpLCData, cchData)
?nretval,LpLCData,TRANSFORM(ASC(SUBSTR(LpLCData,2)),"@0"),TRANSFORM(ASC(LpLCData),"@0") && Euro is Unicode 0x20 0xAC

? "get the currency symbol for UK"
nretval = GetLocaleInfoEx(LPCWSTR, 0x14, @LpLCData, cchData)
?nretval,LpLCData,TRANSFORM(ASC(SUBSTR(LpLCData,2)),"@0"),TRANSFORM(ASC(LpLCData),"@0") && pound is Unicode 0x00 0xA3 or ASCII 0xA3

? "currency position"
nretval = GetLocaleInfoEx(Null, 0x1B, @LpLCData, cchData)

? "decimal separator"
nretval = GetLocaleInfoEx(Null, 0x16, @LpLCData, cchData)

? "thousand separator"
nretval = GetLocaleInfoEx(Null, 0x17, @LpLCData, cchData)

? "number of decimals"
nretval = GetLocaleInfoEx(Null, 0x19, @LpLCData, cchData)


Vilhelm-Ion Praisach

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close