function MyDeleteTree(SourceName:String): Boolean;
var
F:TShFileOpStruct;
begin
F.wnd:=0;
F.wFunc:=FO_DELETE; {操作方式}
F.pFrom:=PChar(SourceName +#0#0);
F.pTo:=PChar(''+#0#0);
F.fFlags:=FOF_SILENT or FOF_NOCONFIRMATION;
result:= ShFileOperation(F)=0;
end;
看看MSDN的详细说明。