📄 singlelastmodifytimeunit.pas
字号:
unit SingleLastModifyTimeUnit;
interface
uses
Classes, SysUtils;
type
TSingleLastModifyThread = class(TThread)
private
{ Private declarations }
sFileName:String;
procedure GetFileLastModifyTime;
protected
procedure Execute; override;
public
constructor Create(_sFileName:String);
end;
implementation
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TSingleLastModifyThread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TSingleLastModifyThread }
uses
FileTestUnit, TestFunctionUnit;
constructor TSingleLastModifyThread.Create(_sFileName:String);
begin
sFileName:=_sFileName;
inherited Create(True);
end;
procedure TSingleLastModifyThread.GetFileLastModifyTime;
var
getStr:String;
begin
getStr:=DateTimeToStr(now)+','+ExtractFileName(sFileName)+' 最近一次被修改的时间为:'+DateTimeToStr(TestFunctionUnit.GetFileLastModifyTime(sFileName));
FileTestForm.ListBox1.Items.Add(getStr);
end;
procedure TSingleLastModifyThread.Execute;
begin
{ Place thread code here }
FreeOnTerminate:=True;
synchronize(GetFileLastModifyTime);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -