try
 ShFileOperation(F);
except
    ShowMessage('文件拷贝失败!');
end;

解决方案 »

  1.   

    其实拷贝文件可以用api   CopyFile 
    或CopyFileTo
      

  2.   

    其实拷贝文件可以用api   CopyFile 
    或CopyFileTo
      

  3.   

    try
    Except
        异常执行代码
    end;try
    finally
       必执行代码
    end;
      

  4.   

    先用FileExists查一下文件是否存在。具体看帮助
      

  5.   

    ShFileOperation(F)是起什么作用的呢??
      

  6.   

    if FileExists('d:/ww/i.txt')<>nil then
    文件存在
    else
    文件不存在!
      

  7.   


    F.fFlags:=FOF_ALLOWUNDO OR FOF_RENAMEONCOLLISION; 
    改成
    F.fFlags:=FOF_ALLOWUNDO OR FOF_RENAMEONCOLLISION OR FOF_NOERRORUI;
      

  8.   

    看看以下说明就知道了
    FOF_ALLOWUNDO  Preserve Undo information, if possible. If pFrom does not contain fully qualified path and file names, this flag is ignored.  
    FOF_FILESONLY  Perform the operation on files only if a wildcard file name (*.*) is specified.  
    FOF_MULTIDESTFILES  The pTo member specifies multiple destination files (one for each source file) rather than one directory where all source files are to be deposited.  
    FOF_NOCONFIRMATION  Respond with "Yes to All" for any dialog box that is displayed.  
    FOF_NOCONFIRMMKDIR  Do not confirm the creation of a new directory if the operation requires one to be created.  
    FOF_NO_CONNECTED_ELEMENTS Version 5.0. Do not move connected files as a group. Only move the specified files.  
    FOF_NOCOPYSECURITYATTRIBS Version 4.71. Do not copy the security attributes of the file. 
    FOF_NOERRORUI  Do not display a user interface if an error occurs.  
    FOF_NORECURSION Only operate in the local directory. Don't operate recursively into subdirectories. 
    FOF_RENAMEONCOLLISION  Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.  
    FOF_SILENT  Do not display a progress dialog box.  
    FOF_SIMPLEPROGRESS  Display a progress dialog box but do not show the file names.  
    FOF_WANTMAPPINGHANDLE  If FOF_RENAMEONCOLLISION is specified and any files were renamed, assign a name mapping object containing their old and new names to the hNameMappings member. 
    FOF_WANTNUKEWARNING Version 5.0. Send a warning if a file is being destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION