string ls_decimal, ls_thousand string ls_regKey = "HKEY_CURRENT_USER/Control Panel/International" RegistryGet(ls_regKey, "sDecimal", ls_decimal) RegistryGet(ls_regKey, "sThousand", ls_thousand)
[local function declaration]
FUNCTION long SendMessageA &
( long hwnd, uint Msg, long wparam, string lparam) &
LIBRARY "USER32"
[powerscript]
long HWND_BROADCAST = 65535
uint WM_SETTINGCHANGE = 26
String ls_separator
String ls_regKey = "HKEY_CURRENT_USER\Control Panel\International"
RegistryGet(ls_regkey, "sDecimal", RegString!, ls_separator)
messagebox("current separator", ls_separator)
IF ls_separator <> "." THEN
// make sure it's a "."
RegistrySet(ls_regkey, "sDecimal", RegString!, ".")
SendMessageA( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'intl' )
END IF
// dbf format requires a "." as the separator
dw_1.saveas("data.dbf" , dbase3!, true)
// put back the original value
RegistrySet(ls_regkey, "sDecimal", RegString!, ls_separator)
SendMessageA( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'intl' )
A simple way to get the decimal separator without querying the Registry is :
IF pos(string(1/2), ".") > 0 THEN
messagebox("dot", ".")
ELSE
messagebox("comma", ",")
END IF
You may want to check this HowTo.
Written and compiled by Réal Gagnon ©1998-2005
[ home ]