关于文件操器的问题. (300分)

  • 主题发起人 makilyang
  • 开始时间
M

makilyang

Unregistered / Unconfirmed
GUEST, unregistred user!
WIN98系统.在注册表中修改成C,D两个盘符隐藏.其它盘所有文件和文件夹都设为隐藏属性,
文件夹选项设成不显示系统文件和隐藏文件.做一个操作器来操作文件.要有打开,删除,
重命名,复制,移动,修改属性的功能.
我现在的主要问题是如何浏览隐藏目录.用什么控件.请大家帮忙.
 
不是难或者简单的问题,你自己已经描述清楚了,一步步实现就行了。如果你提要求,让
别人给你写代码,这恐怕就没人回答了。
 
既然思路已经清楚,写代码就不会很南拉
 
主要是DELPHI的一些控件。要么能显示隐藏文件和文件夹。但却只能操作文件。
像FileListBox。
能对目录操作.像DirectoryListbox之类的。却又不能显示隐藏目录。
我是想知道。对这些控件做什么设置。其它的不重要。
 
隐藏盘改注册表就可以。
 
我当然知道是改注册表.是要改了之后,不用资源管理器也能操作文件.
 
实际上很简单,自己动手是一种乐趣。
自己干吧,遇到问题大家再帮你。
 
控件如果不能设置显示隐藏文件,那就只有修改注册表了。
 
//我现在的主要问题是如何浏览隐藏目录.用什么控件.请大家帮忙.
改目录属性,结束时再改会来;
 
控件不行,可能考虑用 findfirst 自己实现目录和文件的显示!

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 + faArchive;
if CheckBox7.Checked then

FileAttrs := FileAttrs + faAnyFile;

if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then

begin
with StringGrid1 do
begin
if (sr.Attr and FileAttrs) = sr.Attr then
begin
Cells[1,RowCount-1] := sr.Name;
Cells[2,RowCount-1] := IntToStr(sr.Size);
end;
while FindNext(sr) = 0 do
begin
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;
end;
FindClose(sr);
end;
end;
end;
 
多人接受答案了。
 
顶部