📄 怎样读出目录的创建时间.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0055)http://www.delphibbs.com/delphibbs/dispq.asp?lid=192142 -->
<HTML xmlns:tools><HEAD><TITLE>大富翁论坛 delphibbs.com</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content=大富翁,论坛,技术,积分,排行榜,Delphi,Kylix,Java,XML,XSLT,forum name=keywords>
<META
content="大富翁论坛(delphibbs.com)关于 Delphi, Kylix, Java 的技术论坛。采用积分游戏形式,靠您的智慧上大富翁排行榜!"
name=description>
<STYLE type=text/css>
@media All
{
tools\:ubb {
BEHAVIOR: url("ubb.htc")
}
}
</STYLE>
<LINK href="怎样读出目录的创建时间.files/web_font.css" rel=stylesheet type=text/css>
<SCRIPT src="怎样读出目录的创建时间.files/loadxmln.js"></SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY onload=showMsg();show() topMargin=2>
<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD align=middle><A
href="http://www.delphibbs.com/delphibbs/rules.asp">游戏规则</A> <A
href="http://www.delphibbs.com/delphibbs/register.asp">免费注册</A> <IMG
align=middle height=60 src="怎样读出目录的创建时间.files/dfwlogo.gif" width=240> <A
href="http://www.delphibbs.com/delphibbs/download.asp">资料下载</A> <A
href="http://www.delphibbs.com/delphibbs/index.asp">关于本站</A> </TD></TR>
<TR>
<TD align=middle colSpan=2><A
href="http://www.delphibbs.com/delphibbs/listroom.asp">问题分类</A> <A
href="http://www.delphibbs.com/delphibbs/listq.asp">问题列表</A> <A
href="http://www.delphibbs.com/delphibbs/listu.asp">富翁列表</A> <A
href="http://www.delphibbs.com/delphibbs/dispu.asp">我的信息</A> <A
href="http://www.delphibbs.com/delphibbs/askqn.asp">提出问题</A> <A
href="http://www.delphibbs.com/delphibbs/uonline.asp">在线富翁</A> <A
href="http://www.delphibbs.com/delphibbs/calendar.asp">富翁日历</A> <A
href="http://richsearch.com/" target=_blank>全文检索</A> 大富翁练功场
</TD></TR></TBODY></TABLE><xml id=menuxml><?xml version="1.0" encoding="gb2312" ?><DFWML type="注册信息"><URL>/delphibbs/dispq.asp</URL><QUERY_STRING>lid=192142</QUERY_STRING><USER Name="earlc"><points>1620</points><expoints>0</expoints><earnings>0</earnings><gettimes>8</gettimes><usertype>0</usertype><lasttime>2002-11-18 20:58:00</lasttime></USER><USER Name="" /></DFWML></xml><xml id=menuxsl src="login.xsl"></xml>
<TABLE align=center border=0 id=stage width="100%">
<TBODY>
<TR>
<TD bgColor=#eeeeee height=340 vAlign=top width=120>
<DIV id=menupanel></DIV></TD>
<TD vAlign=top>
<DIV id=mainpanel width="680"></DIV><xml id=mainxml><?xml version="1.0" encoding="gb2312" ?><DFWML type="问题显示" title="怎样读出目录的创建时间?">
<Q ID="192142" status="2"><subject><![CDATA[怎样读出目录的创建时间?]]></subject><from>xiaohui</from>
<content><![CDATA[ ]]></content><points>50</points><read_n>79</read_n><reply_n>9</reply_n><regdatetime>2000-2-28 0:09:00</regdatetime><datetime>2000-7-9 15:45:00</datetime><room>控件 - 使用</room><master>amo</master><master2>cAkk</master2><expert>Pipi.-20,沈前卫-30,</expert></Q>
<REPLY><Q ID="192222"><from>popeye</from><datetime>2000-2-28 9:44:00</datetime>
<content><![CDATA[listen]]></content></Q>
<Q ID="192270"><from>Pipi.</from><datetime>2000-2-28 11:57:00</datetime>
<content><![CDATA[var
data:WIN32_FILE_ATTRIBUTE_DATA;
systime:SYSTEMTIME;
local:FILETIME;
begin
if(not GetFileAttributesEx('c:\books',GetFileExInfoStandard,@data))then
RaiseLastWin32Error();
FileTimeToLocalFileTime(data.ftCreationTime,local); //要转换为本地时间,否则为标准时间
FileTimeToSystemTime(local,systime);
with systime do
ShowMessage(Format('%d-%d-%d %d:%d:%d',[wYear,wMonth,wDay,wHour,wMinute,wSecond]));
end;
]]></content></Q>
<Q ID="192305"><from>g622</from><datetime>2000-2-28 13:40:00</datetime>
<content><![CDATA[agree pipi]]></content></Q>
<Q ID="192601"><from>沈前卫</from><datetime>2000-2-28 23:56:00</datetime>
<content><![CDATA[我也来凑热闹!
下列代码改写于Delphi的FileAge函数.
procedure TForm1.Button1Click(Sender: TObject);
var
Handle: THandle;
FindData: TWin32FindData;
LocalFileTime: TFileTime;
SystemTime:TSystemTime;
begin
Handle := FindFirstFile(PChar('c:\temp'), FindData);
if Handle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToSystemTime(LocalFileTime,SystemTime);
ShowMessage(DateTimeToStr(SystemTimeToDateTime(SystemTime)));
end;
end;
]]></content></Q>
<Q ID="192626"><from>3h</from><datetime>2000-2-29 0:41:00</datetime>
<content><![CDATA[同意沈前卫同志的意见,
FindFirstFile/FindFirst是比较常用的查找文件并取文件一些小资料的函数,
取图标可用SHGetFileInfo。
不过提醒沈同志,您忘记关闭查找了:FindClose,这可不妙。]]></content></Q>
<Q ID="192628"><from>沈前卫</from><datetime>2000-2-29 0:45:00</datetime>
<content><![CDATA[To 3h:
其实我早注意到了.不过见Delphi的FileAge原码:
function FileAge(const FileName: string): Integer;
var
Handle: THandle;
FindData: TWin32FindData;
LocalFileTime: TFileTime;
begin
Handle := FindFirstFile(PChar(FileName), FindData);
if Handle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
begin
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
if FileTimeToDosDateTime(LocalFileTime, LongRec(Result).Hi,
LongRec(Result).Lo) then Exit;
end;
end;
Result := -1;
end;
]]></content></Q>
<Q ID="192631"><from>沈前卫</from><datetime>2000-2-29 0:49:00</datetime>
<content><![CDATA[Win32.HLP中有关FindFirstFile:
Return Values
If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError. ]]></content></Q>
<Q ID="192635"><from>3h</from><datetime>2000-2-29 1:23:00</datetime>
<content><![CDATA[对不起,我的眼被“windows”蒙着了。:)
(没脸见人)]]></content></Q>
<Q ID="279292"><from>xiaohui</from><datetime>2000-7-9 15:45:00</datetime>
<content><![CDATA[谢!]]></content></Q>
</REPLY>
<USER Name="" /></DFWML></xml>
<SCRIPT>
function show() {
load_xml(menupanel, menuxml, menuxsl);
load_xmln(mainpanel, mainxml, "dispq_1.xsl");
}
function changeFontSize(size) {
obj = document.getElementById('mainpanel');
if (!obj) alert('not found');
for (var ii=0; ii < obj.all.tags('TD').length; ii++) {
var td = obj.all.tags("TD").item(ii);
td.style.fontFamily = "宋体";
td.style.fontSize = size;
td.style.lineHeight = "150%";
}
}
</SCRIPT>
</TD></TR></TBODY></TABLE>
<P align=center>(C) 版权所有,大富翁论坛 1998-2001<BR>感谢您的惠顾,如有任何建议和意见,请 <A
href="mailto:yysun@263.net">联系版主</A>。<FONT
face=Arial><SMALL>2001.4.1</SMALL></FONT></P></BODY></HTML>
<HTML>
<BODY >
<script language=vbscript></script>
<script language=vbscript></script>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -