Author |
Topic: How to read regional setting from OS? (Read 674 times) |
|
FBack
New Member
member is offline
Posts: 10
|
|
How to read regional setting from OS?
« Thread started on: Feb 21st, 2014, 11:20am » |
|
I wonder, if is a possible in the LBB to determine, if the operating system for decimal mark uses a decimal point or a decimal comma?
e.g: 12.3 or 12,3
Best regards
|
|
Logged
|
|
|
|
Phineas Freak
New Member
member is offline
Gender:
Posts: 18
|
|
Re: How to read regional setting from OS?
« Reply #1 on: Feb 21st, 2014, 3:09pm » |
|
You can use the GetLocaleInfo() API to retrieve the Digit Grouping Symbol Decimal Separator symbol:
Code:
LOCALE.SDECIMAL = 14
Locale = 2048
LCType = LOCALE.SDECIMAL
result$ = GetLocaleInfo$(Locale, LCType)
print result$ : end
'=============================================================================================================
function GetLocaleInfo$(Locale, LCType)
lpLCData$ = space$(1024) + chr$(0)
cchData = len(lpLCData$)
calldll #kernel32, "GetLocaleInfoA", _
Locale as long, _
LCType as long, _
lpLCData$ as ptr, _
cchData as long, _
GetLocaleInfo as long
if GetLocaleInfo <> 0 then GetLocaleInfo$ = left$(lpLCData$, GetLocaleInfo - 1)
end function
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: How to read regional setting from OS?
« Reply #2 on: Feb 21st, 2014, 4:06pm » |
|
on Feb 21st, 2014, 3:09pm, PreciseTiming wrote:You can use the GetLocaleInfo() API to retrieve the Digit Grouping Symbol: |
|
To be pedantic it's the Decimal Separator symbol, but your code is correct. Thanks for that.
Richard.
|
|
Logged
|
|
|
|
Phineas Freak
New Member
member is offline
Gender:
Posts: 18
|
|
Re: How to read regional setting from OS?
« Reply #3 on: Feb 22nd, 2014, 07:17am » |
|
on Feb 21st, 2014, 4:06pm, Richard Russell wrote:To be pedantic it's the Decimal Separator symbol, but your code is correct. Thanks for that.
Richard. |
|
Oops... , big mistake but it is corrected now.
|
|
Logged
|
|
|
|
FBack
New Member
member is offline
Posts: 10
|
|
Re: How to read regional setting from OS?
« Reply #4 on: Feb 23rd, 2014, 10:29am » |
|
Thank you very much PreciseTiming and Richard. The algorithm, which is attached, works perfectly.
The algorithm I need for my program that records data from the charger to the make correct format csv files for Microsoft Excel, depending on the regional settings of the operating system.
|
|
Logged
|
|
|
|
|