用TSearchRec。 Demo: var Rec :TSearchRec; begin if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then begin Rec.Name := OpenDialog1.FileName; ListBox1.Items.Add('文件名:'+Rec.Name); ListBox1.Items.Add('大小:'+IntToStr(Rec.Size)); ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr)); ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time)); end; end;
写错了 -_-# var Rec :TSearchRec; begin if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then begin FindFirst(OpenDialog1.FileName,faAnyFile,Rec); ListBox1.Items.Add('文件名:'+Rec.Name); ListBox1.Items.Add('大小:'+IntToStr(Rec.Size)); ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr)); //属性要对应的去找 end; end;
加上一楼的代码var Rec :TSearchRec; i:integer; begin OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing]; if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then begin for i:= 0 to OpenDialog1.Files.Count -1 do begin Rec.Name := OpenDialog1.Files[i]; ListBox1.Items.Add('ÎļþÃû:'+Rec.Name); ListBox1.Items.Add('´óС:'+IntToStr(Rec.Size)); ListBox1.Items.Add('ÊôÐÔ:'+IntToStr(Rec.Attr)); ListBox1.Items.Add('´´½¨Ê±¼ä:'+IntToStr(Rec.Time)); ListBox1.Items.Add(''); end; end;
刚才有乱码.. var Rec :TSearchRec; i:integer; begin OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing]; if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then begin for i:= 0 to OpenDialog1.Files.Count -1 do begin Rec.Name := OpenDialog1.Files[i]; ListBox1.Items.Add('文件名:'+Rec.Name); ListBox1.Items.Add('大小:'+IntToStr(Rec.Size)); ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr)); ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time)); ListBox1.Items.Add(''); end; end;
Demo:
var
Rec :TSearchRec;
begin
if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
begin
Rec.Name := OpenDialog1.FileName;
ListBox1.Items.Add('文件名:'+Rec.Name);
ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr));
ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time));
end;
end;
OPenDialog1.Execute;
ShowMessage(OPenDialog1.Files.Text);
var
Rec :TSearchRec;
begin
if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
begin
FindFirst(OpenDialog1.FileName,faAnyFile,Rec);
ListBox1.Items.Add('文件名:'+Rec.Name);
ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr)); //属性要对应的去找
end;
end;
Rec :TSearchRec;
i:integer;
begin
OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
begin
for i:= 0 to OpenDialog1.Files.Count -1 do
begin
Rec.Name := OpenDialog1.Files[i];
ListBox1.Items.Add('ÎļþÃû:'+Rec.Name);
ListBox1.Items.Add('´óС:'+IntToStr(Rec.Size));
ListBox1.Items.Add('ÊôÐÔ:'+IntToStr(Rec.Attr));
ListBox1.Items.Add('´´½¨Ê±¼ä:'+IntToStr(Rec.Time));
ListBox1.Items.Add('');
end;
end;
var
Rec :TSearchRec;
i:integer;
begin
OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
begin
for i:= 0 to OpenDialog1.Files.Count -1 do
begin
Rec.Name := OpenDialog1.Files[i];
ListBox1.Items.Add('文件名:'+Rec.Name);
ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr));
ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time));
ListBox1.Items.Add('');
end;
end;
我要这些东西显示在listview里面啊!