如何用API实现文件COPY?

wsansan 2002-12-17 06:17:42
程序段如下:

int nOk;
char strSrc[]= "d:\\temp.txt" ;
char strDst[]= "c:\\temp1.txt" ;
char strTitle[]= "File copying" ;

//进度题头
SHFILEOPSTRUCT FileOp;
//FileOp.hwnd = m_hWnd
FileOp.wFunc = FO_COPY ;
FileOp.pFrom = strSrc ;
FileOp.pTo = strDst ;
FileOp.fFlags = FOF_ALLOWUNDO ;
FileOp.hNameMappings = NULL ;
FileOp.lpszProgressTitle = strTitle ;

//执行文件拷贝
nOk=SHFileOperation(&FileOp);

if(nOk)
ShowMessage("There is an error!");
else
ShowMessage("File copy sucessfull!");

if(FileOp.fAnyOperationsAborted)
ShowMessage("Operation was aborted!");

但一直执行不对,请高手指教!
...全文
31 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wsansan 2002-12-17
  • 打赏
  • 举报
回复
thanks!
invalid 2002-12-17
  • 打赏
  • 举报
回复
char strSrc[]= "d:\\temp.txt\0" ;
char strDst[]= "c:\\temp1.txt\0" ;
char strTitle[]= "File copying" ;

1,221

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧