//==============================================================================
//作者:[email protected]
//日期:2005.9.30
//==============================================================================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellApi;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
T : TSHFileOpStruct;
P:String;
begin
P:= Edit1.Text;//目录名
With T do
Begin
Wnd:=0;
wFunc:=FO_DELETE;
pFrom:=Pchar(P);
pTo:=nil;
fFlags:=FOF_ALLOWUNDO+FOF_NOCONFIRMATION+FOF_NOERRORUI;//标志表明允许恢复,无须确认并不显示出错信息
hNameMappings:=nil;
lpszProgressTitle:='正在删除文件夹';
fAnyOperationsAborted:=False;
End;
SHFileOperation(T);
end;
end.
比格高
逼格更高