修改WINDOWS的长时间格式为短时间格式
请教 :
如何使用DELPHI将WINDOWS的长时间格式修改为短时间格式;
问题点数:0、回复次数:5Top
1 楼dh9450(荡尽尘埃)回复于 2003-11-01 12:30:18 得分 0
改注册表的键值Top
2 楼juwuyi(我有,我可以)回复于 2003-11-01 13:23:05 得分 0
SetLocaleInfo
This function sets an item of locale information. It does so by making an entry in the process portion of the locale table. This setting only affects the user override portion of the locale settings; it does not set the system defaults.
BOOL SetLocaleInfo(
LCID Locale,
LCTYPE LCType,
LPWTSTR lpLCData );
Parameters
Locale
[in] Specifies the locale whose information the function will set. The locale provides a context for the string mapping or sort key generation. An application can use the MAKELCID macro to create a locale identifier.
LCType
[in] Specifies the type of locale information to be set by the function. Note that only one LCTYPE may be specified per call. Not all LCTYPE values are valid; see the list of valid LCTYPE values in the following Remarks section.
lpLCData
[in] Pointer to a null-terminated string that contains the locale information the function will set. The information must be in the specified LCTYPE's particular format.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError. Possible values for GetLastError include the following:
ERROR_INVALID_ACCESS
ERROR_INVALID_FLAGS
ERROR_INVALID_PARAMETER
Remarks
The following LCTYPE values are valid for this function:
LOCALE_ICALENDARTYPE LOCALE_SDATE
LOCALE_ICURRDIGITS LOCALE_SDECIMAL
LOCALE_ICURRENCY LOCALE_SGROUPING
LOCALE_IDIGITS LOCALE_SLIST
LOCALE_IFIRSTDAYOFWEEK LOCALE_SLONGDATE
LOCALE_IFIRSTWEEKOFYEAR LOCALE_SMONDECIMALSEP
LOCALE_ILZERO LOCALE_SMONGROUPING
LOCALE_IMEASURE LOCALE_SMONTHOUSANDSEP
LOCALE_INEGCURR LOCALE_SNEGATIVESIGN
LOCALE_INEGNUMBER LOCALE_SPOSITIVESIGN
LOCALE_IPAPERSIZE LOCALE_SSHORTDATE
LOCALE_ITIME LOCALE_STHOUSAND
LOCALE_S1159 LOCALE_STIME
LOCALE_S2359 LOCALE_STIMEFORMAT
LOCALE_SCURRENCY LOCALE_SYEARMONTH
Windows CE versions 1.0 through 2.01 do not support the LOCALE_IPAPERSIZE LCTYPE value.
Requirements
Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winnls.h Coreloc.lib
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
Top
3 楼whxhz(Super Mac)回复于 2003-11-01 20:46:28 得分 0
还是程序中格式化吧,不然,说不定其他程序又改了呢Top
4 楼WGYKING(修罗是谁?![就缺孩子了……])回复于 2003-11-01 20:53:28 得分 0
同意楼上,在程序里格式化Top
5 楼aiirii(ari-http://spaces.msn.com/members/aiirii/)回复于 2003-11-03 15:04:23 得分 0
var
str: string;
begin
str := 'yy-d-M';
{
yy-d-M
d-yy-M
M-d-yy
yy-M-d
yyyy-M-d
}
if SetLocaleInfoa(LOCALE_SYSTEM_DEFAULT, LOCALE_SLONGDATE, PChar(str)) then
begin
showmessage('更改日期格式成功');
SendMessageA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);
end;
end;Top




