想实现类似MoveFile的文件夹移动功能.
但是MoveFile所能移动的文件夹必须在同一硬盘分区上.
我需要在不同的硬盘分区上实现移动.
有什么函数或方法啊.
请达人指教.

解决方案 »

  1.   

    谁说MoveFile只能同一个分区中移动?
      

  2.   

    try
    SHFILEOPSTRUCT sfo;
        sfo.hwnd = NULL;
        sfo.wFunc = FO_MOVE;
        sfo.pFrom = "c:\\My_Docs2\0";
        sfo.pTo = "d:\\My_Docs2\0";
        sfo.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;    hr = SHFileOperation(&sfo);
      

  3.   

    谢谢vcmute以及hendy_so
    我查了msdn了啊,难得是我英语太次了啊.MoveFileThe MoveFile function moves an existing file or a directory, including its children.To specify how to move the file, use the MoveFileEx function.
    BOOL MoveFile(
      LPCTSTR lpExistingFileName,
      LPCTSTR lpNewFileName
    );Parameters
    lpExistingFileName 
    [in] Pointer to a null-terminated string that names an existing file or directory. 
    In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
    Windows Me/98/95:  This string must not exceed MAX_PATH characters.
    lpNewFileName 
    [in] Pointer to a null-terminated string that specifies the new name of a file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive. 
    In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
    Windows Me/98/95:  This string must not exceed MAX_PATH characters