请参考下面的源代码:
procedure fileoperation(const source,dest:string;op,flags:integer);
var
shf:tshfileopstruct;
s1,s2:string;
begin
fillchar(shf,sizeof(shf),#0);
s1:=source+#0#0;
s2:=dest+#0#0;
shf.Wnd:=0;
shf.wFunc:=op;
shf.pFrom:=pchar(s1);
shf.pTo:=pchar(s2);
shf.fFlags:=flags;
shfileoperation(shf);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
fileoperation('c:/zcjsj/*.*','c:/temp',fo_copy,fof_allowundo+fof_noconfirmation);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
fileoperation('c:/temp/zcjsj.exe','',fo_delete,fof_allowundo+fof_noconfirmation);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
fileoperation('c:/zcjsj/zcjsj.exe','c:/temp',fo_move,fof_allowundo+fof_noconfirmation);
end;