// find char pos at next Delimiter
while(*lpsz != chDelimiter && *lpsz != '\0')
lpsz = _tcsinc(lpsz);
if (!bExplorer && *lpsz == '\0')
pos = NULL;
else
{
if (!bExplorer)
strFileName = strFileName.Left(lpsz - lpszFileName);
lpsz = _tcsinc(lpsz);
if (*lpsz == '\0') // if double terminated then done
pos = NULL;
else
pos = (POSITION)lpsz;
}
// only add '\\' if it is needed
if (!strPath.IsEmpty())
{
// check for last back-slash or forward slash (handles DBCS)
LPCTSTR lpsz = _tcsrchr(strPath, '\\');
if (lpsz == NULL)
lpsz = _tcsrchr(strPath, '/');
// if it is also the last character, then we don't need an extra
if (lpsz != NULL &&
(lpsz - (LPCTSTR)strPath) == strPath.GetLength()-1)
{
ASSERT(*lpsz == '\\' || *lpsz == '/');
return strPath + strFileName;
}
}
return strPath + '\\' + strFileName;
}
然后你就可以快乐的这样访问了
CString FullPathName;
CString sFileLen;
POSITION pos;
In order to access Win2000 specific APIs etc, one needs the following #define in the application's stdafx.h (before any other #includes)
#define _WIN32_WINNT 0x0500
Header File Conventions
This Platform can be used to target applications for Microsoft Windows NT® 4.0, and Microsoft Windows 2000 using the header file conventions below.
The makefiles generated by Microsoft Visual C++® 5.0 and 6.0 target Windows NT 3.51 by default. Therefore, to use functions introduced in Windows NT 4.0 or later, which are protected by conditional code, you must define the appropriate macros. Otherwise, you will receive the following error message from the compiler: error C2065: undeclared identifier. You may also need to ensure that the INCLUDE environment variables has the path to the SDK header files listed before the path to the Visual C++ header files. Otherwise, you will receive error C2065 for items that were introduced after Visual C++ was released.
The following table indicates the macros you must define to target each system using the SDK headers.
Minimum System Required Macros to Define
Windows 95 and Windows NT 4.0 WINVER=0x0400
Windows 98 and Windows NT 4.0 _WIN32_WINDOWS=0x0410 and WINVER=0x0400
Windows NT 4.0 _WIN32_WINNT=0x0400 and WINVER=0x0400
Windows 98 and Windows 2000 WINVER=0x0500
Windows 2000 _WIN32_WINNT=0x0500 and WINVER=0x0500
Internet Explorer 3.0 _WIN32_IE=0x0300
Internet Explorer 4.0 _WIN32_IE=0x0400
Internet Explorer 5.0 _WIN32_IE=0x0500