Article ID: 177146
Article Last Modified on 7/1/2004
Hexadecimal Value Description ------------------------------------------------------- 0x00000014 * Local monetary symbol. * 0x00000015 * International monetary symbol. * 0x00000016 * Monetary decimal separator. * 0x00000017 * Monetary thousand separator. * 0x0000001D * Date separator. * 0x0000001E * Time separator. * 0x0000001F * Short date format string. * 0x00000020 * Long date format string. * 0x0000002A * Long name for Monday. * 0x0000002B * Long name for Tuesday. * 0x0000002C * Long name for Wednesday. * 0x0000002D * Long name for Thursday. * 0x0000002E * Long name for Friday. * 0x0000002F * Long name for Saturday. * 0x00000030 * Long name for Sunday. * 0x00000031 * Abbreviated name for Monday. * 0x00000032 * Abbreviated name for Tuesday. * 0x00000033 * Abbreviated name for Wednesday.* 0x00000034 * Abbreviated name for Thursday. * 0x00000035 * Abbreviated name for Friday. * 0x00000036 * Abbreviated name for Saturday. * 0x00000037 * Abbreviated name for Sunday. *The values above along with others in the Winnls.h can be used in the code below to return and set the properties in Control Panel. Notice the values are hexadecimal. Visual FoxPro for Windows 5.x can use either a hexadecimal or decimal value for the GetLocaleInfo and SetLocaleInfo functions. Visual FoxPro for Windows 3.x, however, must use decimal values for the variables and API function calls.
* Begin code to read system short date format *
*
* Setup declaration and parameters
Declare INTEGER GetLocaleInfo in Win32API LONG Locale, ;
LONG LCType, STRING @LpLCData, INTEGER cchData
* GetSystemDefaultLCID retrieves the system default locale identifier
Declare LONG GetSystemDefaultLCID in Win32API
Declare SetLocaleInfo in Win32API LONG Locale, LONG LCType, ;
STRING @LpLCData
dwLCID = GetSystemDefaultLCID()
Locale = 2048 && For English language.
LpLCData = space(255) && Address of buffer information.
cchData = LEN(LpLCData) && Size of buffer, LpLCData.
nretval = 0 && Number returned from API call.
cShortdate= "" && Hold original short date format.
* Get version, VFP 5 uses Hexadecimal & decimal, VFP 3 only uses decimal
IF "3.00"$VERSION()
LCType = 31 && Type of information. Decimal 31 for short date.
ELSE
LCType = 0x1f && Type of information. Hex 1f for short date.
ENDIF
* Obtain short date format
nretval = GetLocaleInfo(Locale, LCType, @LpLCData, cchData)
If nretval = 0 Then
=MessageBox ("Could not get information.")
Else
=MessageBox (LpLCData, 32, "Short Date Format")
cShortdate = LpLCData && Store original date format.
EndIf
* Variable for new short date format
cNewshortdate = "MM/dd/yy" && Short date style copied from
&& Control Panel.
setdate = SetLocaleInfo(dwLCID, LCType, cNewshortdate)
* Reread the system short date to see change
nretval = GetLocaleInfo(Locale, LCType, @LpLCData, cchData)
=MessageBox (LpLCData, 32, "Updated short Date Format")
* Now reset date to previous format
cNewshortdate = cShortdate
setdate = SetLocaleInfo(dwLCID, LCType, cNewshortdate)
* Verify date is in original format
nretval = GetLocaleInfo(Locale, LCType, @LpLCData, cchData)
=MessageBox (LpLCData, 32, "Original short Date Format")
* End of code
Additional query words: date windows api
Keywords: kbhowto kbcode KB177146