Welcome! Log In Create A New Profile

Advanced

Getting the current decimal separator from Windows

Posted by Jimbo 
Jimbo
Getting the current decimal separator from Windows
November 23, 2008 08:04AM
Hi,

though WinDev Help says that the comma symbol in display masks will be replaced automatically by the decimal separator currently active in Windows, there may be a need to get the current decimal separator from Windows:

PROCEDURE DecimalSeparator()
MAX_BUFFER_SIZE is short int=100
LOCALE_USER_DEFAULT is long int=1024
	LOCALE_SMONDECIMALSEP is long int=22
		
		mApiReturn is long int
		mBuffer is string
		mBufferSize is long int
		
	mBuffer = RepeatString(Charact(0),MAX_BUFFER_SIZE)
mBufferSize = MAX_BUFFER_SIZE - 1

mApiReturn = CallDLL32("kernel32","GetLocaleInfoA",LOCALE_USER_DEFAULT,LOCALE_SMONDECIMALSEP,&mBuffer,mBufferSize)
mBuffer = Left(mBuffer,mApiReturn - 1)

RESULT mBuffer

Acknowledgement: Originally, this code has been taken from the <a href="[www.windasso.org];WinDAsso</b></u></a> web site. However, I cannot find the routine anymore on their site.

Regards,
Guenter
Tor-Bjarne
Re: Getting the current decimal separator from Windows
March 19, 2012 10:31PM
Or you could read the registry:

Info(RegistryQueryValue("HKEY_CURRENT_USER\Control Panel\International\","sMonDecimalSep"])

the ] = ) otherwise example show a smiling smiley

Cheers
Tor-Bjarne
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: