findfirst,findnext,findclose,TSearchRec
其实用 TFileListBox。filelist最简单
其实用 TFileListBox。filelist最简单
解决方案 »
- combobox中最多有多少个item?
- delphi+sql server2000+win2000登录问题
- Delphi复制SQL数据库
- 用什么函数算两个日期之间有多少个月?
- 有没有谁知道如何用delphi实现将数据库的备份文件进行压缩?
- 用程序如何判断打印机是喷墨打印机还是激光打印机?在线等待!
- 高手帮个忙吧,调试了半天没结果 请看里面的代码
- DelphiX 又出了最新版了吗?
- TMemo可以设置背景图片吗?
- 当Toolbar.ShowCaptions:=true时,怎样才能调整toolbutton的大小?
- 如何设置DBE中Access数据库的别名。
- 想能过TAdoConnection对象得到所有的表名,加入到ComboBox对象中,如何做?
用它的Items属性能得到所有文件名
用DELETEFILE?
rc:TSearchRec;用findfirst('c:\ling\*.*',faAnyFile,rc);
我知道此目录下肯定有文件存在。
为什么rc.name的返回值是'.'?
1. .
2. ..
2.
procedure TFMForm.Properties1Click(Sender: TObject);
var
Attributes, NewAttributes: Word;
begin
with FileAttrForm do
begin
FileDirName.Caption := FileList.Items[FileList.ItemIndex];
{ set box caption }
PathName.Caption := FileList.Directory;
{ show directory name }
ChangeDate.Caption :=
DateTimeToStr(FileDateToDateTime(FileAge(FileList.FileName)));
Attributes := FileGetAttr(FileDirName.Caption);
{ read file attributes }
ReadOnly.Checked := (Attributes and faReadOnly) = faReadOnly;
Archive.Checked := (Attributes and faArchive) = faArchive;
System.Checked := (Attributes and faSysFile) = faSysFile;
Hidden.Checked := (Attributes and faHidden) = faHidden;
if ShowModal <> id_Cancel then { execute dialog box }
begin
NewAttributes := Attributes;
{ start with original attributes }
if ReadOnly.Checked then
NewAttributes := NewAttributes or faReadOnly
else
NewAttributes := NewAttributes andnot faReadOnly;
if Archive.Checked then
NewAttributes := NewAttributes or faArchive
else
NewAttributes := NewAttributes andnot faArchive;
if System.Checked then
NewAttributes := NewAttributes or faSysFile
else
NewAttributes := NewAttributes andnot faSysFile;
if Hidden.Checked then
NewAttributes := NewAttributes or faHidden
else
NewAttributes := NewAttributes andnot faHidden;
if NewAttributes <> Attributes then { if anything changed... }
FileSetAttr(FileDirName.Caption, NewAttributes);
{ ...write the new values }
end;
end;
end;