第一种:有时删除文件会出现文件删不掉现象
if lvMain.InnerListView.ItemIndex <> -1 then
begin
// DoContextMenuVerb(lvMain.SelectedFolder, ‘delete‘);
DoContextMenuVerbB(lvMain.Folders[lvMain.InnerListView.ItemIndex],
‘delete‘);
第二种:删除功能很强大,建议使用第二种
Item := SelectMain.Selected;
filename := Item.SubItems.Strings[3];
if DirectoryExists(filename) then
begin
oldroot := tvMain.Root.CustomPath;
DeleteDir(filename + ‘\‘);
if not DirectoryExists(filename) then
Item.Delete;
end
else
begin
DeleteDir(filename);
if not FileExists(filename) then
Item.Delete;
end;
原文地址:http://blog.csdn.net/singular2611/article/details/45014487