瑞文文摘

【delphi源码】删除文件到回收站



标签:delphi源码

删除文件到回收站的源码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ShellApi, StdCtrls;
type
TfrmMain = class(TForm)
edtPath: TEdit;
Label1: TLabel;
btnDelete: TButton;
procedure btnDeleteClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.btnDeleteClick(Sender: TObject);
var
T:TSHFileOpStruct;
P:String;
begin
P:=edtPath.Text;
with T do
begin
Wnd:=0;
wFunc:=FO_DELETE;
pFrom:=Pchar(P);
fFlags:=FOF_ALLOWUNDO
end;
if SHFileOperation(T)=0 then
ShowMessage('删除成功')
else
ShowMessage('删除失败');
end;
end.

上一篇:四年级少先队工作计划

下一篇:【delphi源码】获取驱动器的容量信息



瑞文软件工作室 版权所有 [冀ICP备17033643号]
[联系我们][访问电脑版]