LB Booster
« How to read regional setting from OS? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:25am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: How to read regional setting from OS?  (Read 674 times)
FBack
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx 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
User IP Logged

Phineas Freak
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 18
xx 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
 
« Last Edit: Feb 22nd, 2014, 07:19am by Phineas Freak » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

Phineas Freak
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 18
xx 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... tongue, big mistake but it is corrected now.
User IP Logged

FBack
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx 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.




User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls