下面是我学习delphi时遇到的一段程序代码,我不清楚代码的意思,请帮忙讲解一下!
procedure TForm1.Button1Click(Sender: TObject);
var
sr:tsearchrec;
fileattrs:integer;
begin
stringgrid1.RowCount:=1;
if checkbox1.Checked then
fileattrs:=fareadonly
else
fileattrs:=0;
if checkbox2.Checked then
fileattrs:=fileattrs+fahidden;
if checkbox3.Checked then
fileattrs:=fileattrs+fasysfile;
if checkbox4.Checked then
fileattrs:=fileattrs+favolumeid;
if checkbox5.Checked then
fileattrs:=fileattrs+fadirectory;
if checkbox6.Checked then
fileattrs:=fileattrs+faanyfile;
if checkbox6.Checked then
fileattrs:=fileattrs+faarchive;
with stringgrid1 do
begin
rowcount:=0;
if findfirst(edit1.Text,fileattrs,sr)<>0 then//这个地方不知道该是什么符号,不管时=、<>都不懂!
begin
Cells[1,0]:='文件名';
Cells[2,0]:='大小(k)';
repeat
if(sr.Attr and fileattrs)=sr.attr then
begin
rowcount:=rowcount+1;
cells[1,rowcount-1]:=sr.Name;
cells[2,rowcount-1]:=inttostr(sr.Size);
end;
until findnext(sr)<>0;//这里也是同样不理解,到底0是真还是假,请告知!
findclose(sr);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
sr:tsearchrec;
fileattrs:integer;
begin
stringgrid1.RowCount:=1;
if checkbox1.Checked then
fileattrs:=fareadonly
else
fileattrs:=0;
if checkbox2.Checked then
fileattrs:=fileattrs+fahidden;
if checkbox3.Checked then
fileattrs:=fileattrs+fasysfile;
if checkbox4.Checked then
fileattrs:=fileattrs+favolumeid;
if checkbox5.Checked then
fileattrs:=fileattrs+fadirectory;
if checkbox6.Checked then
fileattrs:=fileattrs+faanyfile;
if checkbox6.Checked then
fileattrs:=fileattrs+faarchive;
with stringgrid1 do
begin
rowcount:=0;
if findfirst(edit1.Text,fileattrs,sr)<>0 then//这个地方不知道该是什么符号,不管时=、<>都不懂!
begin
Cells[1,0]:='文件名';
Cells[2,0]:='大小(k)';
repeat
if(sr.Attr and fileattrs)=sr.attr then
begin
rowcount:=rowcount+1;
cells[1,rowcount-1]:=sr.Name;
cells[2,rowcount-1]:=inttostr(sr.Size);
end;
until findnext(sr)<>0;//这里也是同样不理解,到底0是真还是假,请告知!
findclose(sr);
end;
end;
end;
解决方案 »
- 有关FastReport的两个问题
- 哪位兄弟有DevExpress ExpressOrgChart v1.3 forD5的控件?
- 如何强制改变ADOQuery.Eof的值????????
- 一个关于CHR函数的使用方法,请指教,再线等,谢谢
- 菜单栏上 贴的图片 挡住了菜单 上的文字,怎么办?
- 请教 如何实现窗口间的变量传递
- 如何实现多机之间的数据传递?
- 组件中创建timer问题
- 如何在窗体关闭时判断某条件,不满足时不让窗体退出?
- 如何将ListView里的某一列加起来!
- 本要想花2k买FAST REPORT 4的FOR DELPHI 版本.大家有什么意见?
- Com+客户须要安装组件吗? 里面有问题超详细描述。
Attr 是 Windows 定义的一些组合, 有以下, 不说也明了吧
faReadOnly Read-only files
faHidden Hidden files
faSysFile System files
faVolumeID Volume ID files
faDirectory Directory files
faArchive Archive files
faAnyFile Any fileFindFirst & FindNext 返回的结果是 0 是找到了文件, 其它就是错误码