//拷贝目录或文件<br>uses ShellApi<br><br>procedure SetQCopy_D_File(Const Source_File,Target_File:string);<br>var<br> T: TSHFileOpStruct;<br> Frombuf, Tobuf: Array [0..MAX_PATH-1] of Char;<br>Begin<br> FillChar(Frombuf, Sizeof(Frombuf),0);<br> FillChar(Tobuf, Sizeof(Tobuf),0);<br> StrPCopy(Frombuf,Source_File);<br> StrPCopy(Tobuf,Target_File);<br> with T do<br> begin<br> Wnd:= Application.Handle; //拷贝目录或文件<br> wFunc:= FO_COPY;<br> pFrom:= @Frombuf;<br> pTo:=@Tobuf;<br> fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;<br> fAnyOperationsAborted:= False;<br> hNameMappings:= nil;<br> lpszProgressTitle:= nil;<br> end;<br> ShFileOperation(T);<br>end;<br><br>===============================================<br>使用:<br>复制目录:比如 SetQCopy_D_File('C:/abc','D:/123');<br>复制文件:比如 SetQCopy_D_File('C:/abc.txt','D:/123.txt');