Link to home
Start Free TrialLog in
Avatar of BergJC
BergJC

asked on

Win NT/ Decimal separator

Currently for Win95, I use the WIN.INI file to get the decimal and thousands separator for my application. I've noticed, however, that the Win NT WIN.INI file does not hold this information. Is there a NT equivalent, or am I going to have to used API calls to get that info?
Avatar of vikiing
vikiing

If your idea is to format numeric output, you can use the standard mask "#,###.##" (or similar). With that, Format$() function will use whatever is defined in your system, this is, if your system is set to use a comma for decimal separator and period for thousands, that mask will do the job.

If comma and period swap their meaning, *THE SAME* mask will keep on working, giving always the right display.
You must be careful because depending on which regional settings for the machine are set will change the dec sep required.  It is by far better to use the API call:

Private 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

ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BergJC

ASKER

I am aware of this API call to get the decimal separator. I've already written the code for regional settings, I just need the separators. I used the WIN.INI file because it was much simpler (and when you don't support the system, you want to make it as simple as possible for others). I'm guessing that from your answers that there isn't an equivalent to the entries inside the Win95 WIN.INI file for WinNT. Is this correct?
Yes, that it correct. The win.ini is not used anymore. The registry is always the most up to date information.
BTW: I think that using GetLocaleInfo is as easy as reading the win.ini