自己搞定,用了2千个文件测试,全部装入pfrom中,SHFileOperation复制正常,看来不用担心容量<br><br>function CopyFile(SourceName, TargetName: string): Boolean;<br>var<br> F: TShFileOpStruct;<br> Index: Integer;<br> Fromdir,Todir,ToFile:string;<br>begin<br> for Index := 0 to namelist.Count - 1 do<br> begin<br> Fromdir := fromdir+namelist[index]+#0;//从namelist中取出文件名,用#0隔开<br> ToFile :=TargetName+ copy(namelist[index],length(SourceName)+1,<br> length(namelist[index])-length(SourceName));//转换为目标路径<br> Todir :=Todir+ToFile+#0;<br> end;<br> F.wnd := Form1.Handle;<br> F.wFunc := FO_COPY; {操作方式}<br> F.pFrom := PChar(fromdir+#0);<br> F.pTo := PChar(Todir+ #0);<br> <br> F.fFlags:= FOF_NOCONFIRMATION or FOF_MULTIDESTFILES <br> F.fAnyOperationsAborted:= true;<br> if ShFileOperation(F)<>0 then showmessage('文件没复制完');<br> if IOResult<>0 then showmessage('文件没复制完');<br><br> end;<br>==============================================<br>namelist为函数外部定义的一个全局变量,里面装的是需拷贝的文件列表,定义如下<br>var namelist:Tstringlist;