一、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类的几个用法
1,char ach[] 转换为CString
构造函数中:
CString str(“hjkl”);
Format
CAtlString str;
str.Format("%s ", "Some Data");
2,CString转换为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)
的实现是一模一样。