Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CDOW Problem
Message
De
09/07/2003 04:04:32
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00808318
Message ID:
00808357
Vues:
11
Hi Alexander,

thanks for that suggestion. Is it possible to is this with other (not the computer local) languages?

Agnes
>Agnes,
>
>May be these functions to return local weekday and month names (two versions for each function) could help you:
>
>For i = 1 to 12
>? LocalMonthName1(i, .T.), LocalMonthName2(i)
>EndFor
>
>For i = 1 to 7
>? LocalWeekdayName1(i, .T.), LocalWeekdayName2(i)
>EndFor
>
>Function LocalMonthName1(tnMonth, tlAbbrev)
>If (VarType(tnMonth) != 'N') Or (tnMonth < 1) Or (tnMonth > 12) Or (VarType(tlAbbrev) != 'L')
>	Error 11
>EndIf
>
>Local buf, n
>Declare Long GetLocaleInfo In Win32API ;
>	Long Locale, Long LCType, String @ lpLCData, Long cchData
>buf = Replicate(Chr(0), 16)
>n = GetLocaleInfo(0, IIf(tlAbbrev, 0x43, 0x37) + tnMonth, @buf, 16)
>Return Left(buf, n - 1)
>
>Function LocalMonthName2(tnMonth, tlAbbrev)
>If (VarType(tnMonth) != 'N') Or (tnMonth < 1) Or (tnMonth > 12) Or (VarType(tlAbbrev) != 'L')
>	Error 11
>EndIf
>
>Local bstr, buf, n
>Declare Long VarMonthName In Oleaut32.dll ;
>	Long iMonth, Long fAbbrev, Long dwFlags, Long @ pbstrOut
>Declare Long WideCharToMultiByte In Win32API ;
>	Long CodePage, Long dwFlags, Long lpWideStr, Long cchWide, ;
>	String @ lpMultiByte, Long cbMultiByte, Long lpDefaultChar, Long lpUsedDefaultChar
>Declare Long SysStringLen In Oleaut32.dll Long bstr
>Declare SysFreeString In Oleaut32.dll Long bstr
>bstr = 0
>VarMonthName(tnMonth, Iif(tlAbbrev, 1, 0), 0, @bstr)
>buf = Replicate(Chr(0), 16)
>n = WideCharToMultiByte(0, 0, bstr, SysStringLen(bstr), @buf, 16, 0, 0)
>SysFreeString(bstr)
>Return Left(buf, n)
>
>Function LocalWeekdayName1(tnWeekday, tlAbbrev)
>If (VarType(tnWeekday) != 'N') Or (tnWeekday < 1) Or (tnWeekday > 7) Or (VarType(tlAbbrev) != 'L')
>	Error 11
>EndIf
>
>Local buf, n
>Declare Long GetLocaleInfo In Win32API ;
>	Long Locale, Long LCType, String @ lpLCData, Long cchData
>buf = Replicate(Chr(0), 16)
>n = GetLocaleInfo(0, IIf(tlAbbrev, 0x30, 0x29) + tnWeekday, @buf, 16)
>Return Left(buf, n - 1)
>
>Function LocalWeekdayName2(tnWeekday, tlAbbrev)
>If (VarType(tnWeekday) != 'N') Or (tnWeekday < 1) Or (tnWeekday > 7) Or (VarType(tlAbbrev) != 'L')
>	Error 11
>EndIf
>
>Local bstr, buf, n
>Declare Long VarWeekdayName In Oleaut32.dll ;
>	Long iWeekday, Long fAbbrev, Long iFirstDay, Long dwFlags, Long @ pbstrOut
>Declare Long WideCharToMultiByte In Win32API ;
>	Long CodePage, Long dwFlags, Long lpWideStr, Long cchWide, ;
>	String @ lpMultiByte, Long cbMultiByte, Long lpDefaultChar, Long lpUsedDefaultChar
>Declare Long SysStringLen In Oleaut32.dll Long bstr
>Declare SysFreeString In Oleaut32.dll Long bstr
>bstr = 0
>VarWeekdayName(tnWeekday, Iif(tlAbbrev, 1, 0), 0, 0, @bstr)
>buf = Replicate(Chr(0), 16)
>n = WideCharToMultiByte(0, 0, bstr, SysStringLen(bstr), @buf, 16, 0, 0)
>SysFreeString(bstr)
>Return Left(buf, n)
>
>
>>Hi All,
>>
>>I have a problem with the CDOW() command.
>>
>>In VFP 7.0 it returns german days as expected on a german windows with german VFP
>>
>>Now I use VFP 8.0 wich MS was unfriendly enough to skip the german version (I know a lot of people that will skip VFP because of that). CDOW() returns english days. I've tried to use the german runtime but that changes nothing.
>>
>>How to set CDOW() so that it respond the days in the language I neeed?
>>
>>Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform