怎样才可以删除目录(30分)

  • 主题发起人 主题发起人 lkwkang
  • 开始时间 开始时间
L

lkwkang

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么样才可以删除delphi7打开过文件的目录,就是reopen那里的目录.我是个初学者,不知道怎样删除,在这里希望大家能帮帮我这个菜鸟!
 
打开过文件的目录在注册表里面
HKEY_CURRENT_USER/Software/Borland/Delphi/7.0/Closed Files
HKEY_CURRENT_USER/Software/Borland/Delphi/7.0/Closed Projects
 
但是删除了,在reopen里还是没有删掉的.从新开机注册表又有了.还有没有其他的办法!
 
接受答案了.
 
function EmptyDirectory(TheDirectory :String ; Recursive : Boolean) :
Boolean;
var
SearchRec : TSearchRec;
Res : Integer;
begin
Result := False;
TheDirectory := NormalDir(TheDirectory);
Res := FindFirst(TheDirectory + '*.*', faAnyFile, SearchRec);
try
while Res = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
begin
if ((SearchRec.Attr and faDirectory) > 0) and Recursive
then begin
EmptyDirectory(TheDirectory + SearchRec.Name, True);
RemoveDirectory(PChar(TheDirectory + SearchRec.Name));
end
else begin
DeleteFile(PChar(TheDirectory + SearchRec.Name))
end;
end;
Res := FindNext(SearchRec);
end;
Result := True;
finally
FindClose(SearchRec.FindHandle);
end;
end;
EmptyDirectory(C:/Documents and Settings/Administrator/Application,Data/Microsoft/Office/Recent,true)
 
后退
顶部