关于0x41的问题
来源:百度知道 编辑:UC知道 时间:2024/05/26 06:21:05
int nPos = 0;
UINT nCount = 0;
CString strDrive = "?:\\";
DWORD dwDriveList = ::GetLogicalDrives ();
CString cTmp;
while (dwDriveList) {
if (dwDriveList & 1) {
cTmp = strDrive;
strDrive.SetAt (0, 0x41 + nPos);
if (AddDrives(strDrive , hParent))
nCount++;
}
dwDriveList >>= 1;
nPos++;
}
这是个插入资源管理器左边系统目录的程序,strDrive.SetAt (0, 0x41 + nPos);这句话不是很明白,请高手指导
UINT nCount = 0;
CString strDrive = "?:\\";
DWORD dwDriveList = ::GetLogicalDrives ();
CString cTmp;
while (dwDriveList) {
if (dwDriveList & 1) {
cTmp = strDrive;
strDrive.SetAt (0, 0x41 + nPos);
if (AddDrives(strDrive , hParent))
nCount++;
}
dwDriveList >>= 1;
nPos++;
}
这是个插入资源管理器左边系统目录的程序,strDrive.SetAt (0, 0x41 + nPos);这句话不是很明白,请高手指导
0x41就是ASCII字符'A'
strDrive.SetAt (0, 0x41 + nPos);的含义就是根据预先得出的偏移量nPos,将字符串strDrive(最开始是“?:\\”)的第一个字符“?”改成'A'加上偏移量。
例如nPos=2的话,那么strDrive就变成“C:\\”。