//判断是否为可移动设备 bool isRemovableDrive(const QFileInfo filePath) { QString rootPath = filePath.absolutePath().left(3); // 获取文件所在磁盘的根路径 // 将QString转换为wchar_t* LPCWSTR rootPathW = (LPCWSTR)rootPath.utf16(); // 获取磁盘类型 UINT driveType = GetDriveType(rootPathW); // 判断是否为可移动设备 return driveType == DRIVE_REMOVABLE; }
点赞 评论

相关推荐

牛客网
牛客企业服务