谁知道怎么用DELPHI写一个类似于DOS的XCOPY 、 DELTREE 的函数,实现带子目录拷贝和删除(20分)

  • 主题发起人 主题发起人 lxftwo
  • 开始时间 开始时间
L

lxftwo

Unregistered / Unconfirmed
GUEST, unregistred user!
谁知道怎么用DELPHI写一个类似于DOS的XCOPY 、 DELTREE 的函数,实现带子目录拷贝和删除,请写详细一点,多谢!
 
procedure TForm1.moveClick(Sender: TObject);<br>//移动c:/sybase目录下所有文件到d:/sybase目录下<br>var<br>&nbsp; sourcefile,destinationfile:STRING;<br>&nbsp; lpfileop:TSHFILEOPSTRUCT;<br>begin<br>&nbsp; sourcefile:= 'c:/sybase/*.*'+#0#0;<br>&nbsp; destinationfile:= 'd:/sybase'+#0#0;<br>&nbsp; fillchar(lpfileop,sizeof(lpfileop),0);<br>&nbsp; with lpfileop do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;wnd:=form1.handle;<br>&nbsp; &nbsp; &nbsp; &nbsp;wFunc:=FO_MOVE;<br>&nbsp; &nbsp; &nbsp; &nbsp;pFrom:=pchar(sourcefile);<br>&nbsp; &nbsp; &nbsp; &nbsp;pTo:=pchar(destinationfile);<br>&nbsp; &nbsp; &nbsp; &nbsp;fflags:= FOF_NOCONFIRMATION or FOF_NOCONFIRMMKDIR;<br>&nbsp; &nbsp;end;<br>&nbsp; if &nbsp;SHFileOperation(lpfileop)&lt;&gt;NOERROR then<br>&nbsp; &nbsp; &nbsp; if &nbsp;lpfileop. FAnyOperationsAborted then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('移动文件被终止') <br>&nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('移动文件出错');<br>&nbsp; <br>end;<br>
 
请问高手,你写的moveClick是什么事件呀, 我怎么没找到?
 
后退
顶部