复制文件。<br> procedure TForm1.Button1Click(Sender: TObject);<br> begin<br> try<br> copyfileA(pchar('C:/AAA.txt'),pchar('D:/AAA.txt'),false);<br> except<br> showmessage('sfdsdf');<br> end;<br> end;<br>复制文件夹。<br> uses shellAPI;<br> procedure TForm1.Button1Click(Sender: TObject);<br> var<br> lpFileOp: TSHFileOpStruct;<br> begin<br> with lpFileOp do<br> begin<br> Wnd:=Self.Handle;<br> wfunc:=FO_COPY;<br> pFrom:=pchar('C:/AAA');<br> pTo:=pchar('D:/AAA');<br> fFlags:=FOF_ALLOWUNDO;<br> hNameMappings:=nil;<br> lpszProgressTitle:=nil;<br> fAnyOperationsAborted:=True;<br> end;<br> if SHFileOperation(lpFileOp)<>0 then<br> ShowMessage('删除失败');<br> end;