MFC程序的话,通过CFileStatus来获取文件属性看起来更方便些。如: UpdateData(TRUE); CFileStatus status; if(CFile::GetStatus(m_strFile, status)) { m_strSize.Format(_T("%d字节"),status.m_size); m_strCTime = status.m_ctime.Format(_T("%Y-%m-%d %H:%M:%S")); m_strMTime = status.m_mtime.Format(_T("%Y-%m-%d %H:%M:%S")); m_strATime = status.m_atime.Format(_T("%Y-%m-%d %H:%M:%S")); //=========================================================================== //enum Attribute { // normal = 0x00, //x01, // hidden = 0x02, // system = 0x04, // volume = 0x08, // directory = 0x10, // archive = 0x20 // }; //=========================================================================== //readOnly if(status.m_attribute & 0x01) m_bReadOnly = TRUE; else m_bReadOnly = FALSE; //archive if(status.m_attribute & 0x20) m_bArchive = TRUE; else m_bArchive = FALSE; //hidden if(status.m_attribute & 0x02) m_bHidden = TRUE; else m_bHidden = FALSE; //system if(status.m_attribute & 0x04) m_bSystem = TRUE; else m_bSystem = FALSE; UpdateData(FALSE); } else { m_strSize = _T("未知"); m_strCTime = _T("未知"); m_strMTime = _T("未知"); m_strATime = _T("未知"); m_bReadOnly = FALSE; m_bArchive = FALSE; m_bHidden = FALSE; m_bSystem = FALSE; UpdateData(FALSE); AfxMessageBox(_T("GetStatus failed!")); }