请教一下,如何实现不同目录下的Excel文件复制??

解决方案 »

  1.   

    CopyFile('C:\a.xls', 'D:\bb.xls', True);
      

  2.   

    你可以看一下DELPHI的帮助,里面有COPYFILE这个函数的
    还有你可以用WINDOWS的API函数SHFileOperation Function--------------------------------------------------------------------------------Copies, moves, renames, or deletes a file system object. Syntaxint SHFileOperation(          LPSHFILEOPSTRUCT lpFileOp
    );
    ParameterslpFileOp
    [in] Address of an SHFILEOPSTRUCT structure that contains information this function needs to carry out the specified operation. This parameter must contain a valid value that is not NULL. You are responsibile for validating the value. If you do not validate it, you will experience unexpected results. 
    Return ValueReturns zero if successful, or nonzero otherwise. ResYou should use fully-qualified pathnames with this function. Using it with relative path-names is not thread-safe.With two exceptions, you cannot use SHFileOperation to move special folders from a local drive to a remote computer by specifying a network path. The exceptions are the My Documents and My Pictures folders (CSIDL_PERSONAL and CSIDL_MYPICTURES, respectively).When used to delete a file, SHFileOperation will attempt to place the deleted file in the Recycle Bin. If you wish to delete a file and guarantee that it will not be placed in the Recycle Bin, use DeleteFile.If a copy callback handler is exposed and registered, SHFileOperation will call it unless you set a flag such as FOF_NOCONFIRMATION in the fFlags member of the structure pointed to by lpFileOp. See ICopyHook::CopyCallback for details on implementing copy callback handlers. File deletion is recursive unless you set the FOF_NORECURSION flag in lpFileOp.With Microsoft® Windows® 2000 and later, it is possible to connect an HTML file with a folder containing related files such as Graphics Interchange Format (GIF) images or style sheets. If file connection is enabled, when you move or copy the HTML file, all of the files in the folder will be moved or copied as well. Conversely, if you move the folder with the related files, the HTML file is also moved.The HTML file must have a .htm or .html extension. You create the connection to the related files by placing them in a subfolder of the folder containing the HTML file. The folder must have the name of the HTML file followed by " files". For example, if the HTML file is MyFile.htm, the folder should be named "MyFile files". Any files you place in the "MyFile files" subfolder will be connected to MyFile.htm. File connection is enabled by default. It can be disabled by adding a REG_DWORD value, NoFileFolderConnection, to this registry key. HKEY_CURRENT_USER
    Software
    Microsoft
    Windows
    CurrentVersion
    Explorer
    NoFileFolderConnection=
    Setting NoFileFolderConnection to 1 disables file connection. If the value is set to zero or is missing, file connection is enabled.To move only specified files from a group of connected files, set the FOF_NO_CONNECTED_ELEMENTS flag in the fFlags member of the structure pointed to by lpFileOp.Note that the use of a folder with a name like "MyFile files" to define a connection may not be valid for localized versions of Microsoft Windows NT®. The term "files" may need to be replaced by the equivalent word in the local language.Windows 95/98/Me: ShellExecute is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.Function InformationStock Implementation shell32.dll version 4.00 or later 
    Custom Implementation No 
    Header shellapi.h 
    Import library shell32.lib 
    Minimum operating systems Windows NT 4.0, Windows 95