090901项目进展:smb资源的深层递归3

一、SetCurrentDirectory

使用这个函数,把当前目录定位到已经连接好的服务器上。

改动后的AddConnectableRcs函数:

 

 

二、FindFirstFile的用法

昨天那种使用方法,第一个参数搞成“目的路径”,用错了。

lpFileName

[in] A pointer to a null-terminated string that specifies a valid directory or path, and file name that can contain wildcard characters, for example, an asterisk (*) or a question mark (?).

If the string ends with a wildcard, period (.), or directory name, the user must have access to the root and all subdirectories on the path.

 

In the ANSI version of this function, the name is limited to MAX_PATH CHARs. 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 CHARs.

lpFindFileData

[out] A pointer to the WIN32_FIND_DATA structure that receives information about a found file or subdirectory.

 

    if (!SetCurrentDirectory(lpConnectable->lpRemoteName))

    {

        DWORD dwErrorCode = GetLastError();

        printf ("SetCurrentDirectory. Error is %u/n", dwErrorCode);

        return (-1);

    }

 

    hFind = FindFirstFile("*", &FindFileData);

    if (hFind == INVALID_HANDLE_VALUE)

    {

        DWORD dwErrorCode = GetLastError();

        printf ("Invalid file handle. Error is %u/n", dwErrorCode);

        return (-1);

    }

    else

    {

        printf ("First file name is %s/n", FindFileData.cFileName);

        while (FindNextFile(hFind, &FindFileData) != 0)

        {

//            printf ("Next file name is %s/n", FindFileData.cFileName);

            HTREEITEM hItemChild = pTree->InsertItem(FindFileData.cFileName,0,1, hItemParent, TVI_LAST);

        }…}

 

三、CString类的几个用法

1char ach[] 转换为CString

构造函数中:

CString str(“hjkl”);

Format

CAtlString str;

str.Format("%s ", "Some Data");

 

 

2CString转换为char ach[]

sprintf(destip, "%s", cstrTemp.GetBuffer(cstrTemp.GetLength()));

3,删除

strSmbFile.Delete(0, cntDelete);

4,替换

int n = strBang.Replace(_T("field hockey"), _T("soccer"));

 

四、完成了FindFirstFile的功能,遍历全部文件和

void CListContent::DownLoadTreeContent_WPS(int maxLayer)

的实现是一模一样。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值