怎样将本地的文件夹复制到网上邻居中的共享文件夹下(有读写权限)。(50分)

  • 主题发起人 主题发起人 big_brian
  • 开始时间 开始时间
B

big_brian

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样将本地的文件夹复制到网上邻居中的共享文件夹下(有读写权限)。<br>使用那些API,或者使用那些Delphi封装的函数?急急急!!请高手帮忙!!
 
代码:
<br>// sShare - 网络共享路径<br>procedure TformClient.UploadFile(sShare: string);<br>var<br>&nbsp; sPath &nbsp;: string;<br>&nbsp; Fo &nbsp; &nbsp; : TSHFileOpStruct;<br>&nbsp; msg &nbsp; &nbsp;: string;<br>begin<br>&nbsp; if SelectDirectory('','',sPath) then<br>&nbsp; begin<br>&nbsp; &nbsp; Fo.Wnd &nbsp; &nbsp;:= Handle;<br>&nbsp; &nbsp; Fo.wFunc &nbsp;:= FO_COPY;<br>&nbsp; &nbsp; Fo.pFrom &nbsp;:= pchar(sPath);<br>&nbsp; &nbsp; Fo.pTo &nbsp; &nbsp;:= pchar(sShare); &nbsp; &nbsp; //sShare最后一位不能是'/'<br>&nbsp; &nbsp; Fo.fFlags := 0;<br>&nbsp; &nbsp; if SHFileOperation(Fo) = 0 then<br>&nbsp; &nbsp; &nbsp; &nbsp;msg:= 'ok!'<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp;msg:= 'error:'+SysErrorMessage(GetLastError());<br>&nbsp; &nbsp; MessageBox(handle,pchar(msg),'Title',MB_OK+MB_ICONWARNING); &nbsp; &nbsp;<br>end;<br>
 
接受答案了.
 
后退
顶部