看这个.
procedure DeleteDirectory(const Path,WindowTitle:string);
Var T:TSHFileOpStruct;
begin
With T do Begin
Wnd:=0;
wFunc:=FO_DELETE;
pFrom:=Pchar(Path);
pTo:=nil;
///fFlags:=FOF_ALLOWUNDO+FOF_NOCONFIRMATION+FOF_NOERRORUI;//标志表明允许恢复,无须确认并不显示出错信息
fFlags:=FOF_NOCONFIRMATION+FOF_NOERRORUI;//标志表明允许恢复,无须确认并不显示出错信息
hNameMappings:=nil;
lpszProgressTitle:=pchar(WindowTitle);
fAnyOperationsAborted:=False;
End;
SHFileOperation(T);
end;