本帖最后由 huangqibin888 于 2010-12-22 11:14:31 编辑

解决方案 »

  1.   

    子项需要你自己去遍历
    一般这种情况都会自己建立一套数据结构和TREEVIEW来对应,复制的时候复制一份你自己的数据结构,然后对照数据结构在TREEVIEW上建立相应的节点
      

  2.   

    请问下TEEEVIEW如何和数据结构来对应呢?
      

  3.   

    用这个函数拷贝/////////////////////////////////////
    //函数名:CopyFolder
    //参数:lpszFromPath 源文件夹的路径 。 lpszToPath 目的文件夹的路径
    //作用:拷贝文件夹及其文件夹中的所有内容
    //
    //////////////////////////////////////BOOL CFileObjectMgr::CopyFolder(LPCTSTR lpszFromPath,LPCTSTR lpszToPath)
    {
    int nLengthFrm = strlen(lpszFromPath);
    char *NewPathFrm = new char[nLengthFrm+2];
    strcpy(NewPathFrm,lpszFromPath);
    NewPathFrm[nLengthFrm] = '\0';
    NewPathFrm[nLengthFrm+1] = '\0';
    SHFILEOPSTRUCT FileOp;
    ZeroMemory((void*)&FileOp,sizeof(SHFILEOPSTRUCT));
    FileOp.fFlags = FOF_NOCONFIRMATION ;
    FileOp.hNameMappings = NULL;
    FileOp.hwnd = NULL;
    FileOp.lpszProgressTitle = NULL;
    FileOp.pFrom = NewPathFrm;
    FileOp.pTo = lpszToPath;
    FileOp.wFunc = FO_COPY;
    BOOL bRet =  SHFileOperation(&FileOp) == 0;
    if( NewPathFrm )
    {
    delete NewPathFrm;
    NewPathFrm = NULL;
    }
    return bRet;
    }