我要获取的文件夹属性是, 属性对话框中特殊选项卡中的信息,举个例:如rar文件的属性对话框中有一个选项卡----名为"压缩文件",怎样获取该选项卡中的信息?
    GetFileAttributes这是不能实现的,GetFileVersion只能得到选项卡名为"version"的相关信息,这些都不是我要的答案,谢谢高手指点?

解决方案 »

  1.   

    就是Shell扩展编程了,那个资料里面有详细的方法
      

  2.   

    ---------------->>>>>>>>>>>就是Shell扩展编程
      

  3.   

    SHGetFileInfo 具体请查看MSDN
      

  4.   

    试一下static BOOL PASCAL GetStatus(LPCTSTR lpszFileName,CFileStatus& rStatus);
    lpszFileName为路径,rStatus为其属性
    rStatus.m_ctime//创建时间
    rStatus.m_mtime//最后一次修改时间
    rStatus.m_atime//最后一次被访问时间
    rStatus.m_size//大小
    rStatus.m_attribute//只读,系统等
    ................
      

  5.   

    SHFILEINFO sfi;
    ZeroMemory(&sfi,sizeof(sfi));
    SHGetFileInfo("c:\\aaa\\blank.zip",
    FILE_ATTRIBUTE_NORMAL,
    &sfi,
    sizeof(sfi),
    SHGFI_TYPENAME);
    sfi.szTypeName;//这就是你要的
      

  6.   

    to  TA_V_SFIQ_SFIQ()  &   lyg_zy(学无止境,宁静致远)  
    那些都不能得到我想要的结果,谢谢你们的参与!非常感谢各位的支持,此问题已得到正解,结贴
      

  7.   

    显示文件或文件夹的属性SHELLEXECUTEINFO ShExecInfo ={0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = "properties";
    ShExecInfo.lpFile = "c:\\"; //can be a file as well
    ShExecInfo.lpParameters = ""; 
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = SW_SHOW;
    ShExecInfo.hInstApp = NULL; 
    ShellExecuteEx(&ShExecInfo); 
      

  8.   

    实现有点复杂, 主要手段是 Extending the Shell Handler(Property Sheet),用COM实现若干接口(如IpersistXXX),定制接口并实现,其中要注意你要查看property,还是以.zip格式的文件为例它的
        CLSID            {FB61C8ED-A6E4-11d0-8A43-00A0C91E2ACD}
        DefaultExtension  .zip
    重要的扩展这个Handler----{7bcabcb0-f239-11d0-b14e-00a0c91e2acd} 其它的参见MSDN.   
      

  9.   

    扩展Handler的例子参见www.codeproject.com
      

  10.   

    UpdateData(TRUE);
    //在打开文件对话框中选择文件
    CFileDialog FileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY, "All Files (*.*)|*.*||");
    //如果未打开文件,则返回
    if (FileDlg.DoModal()==IDCANCEL)
    return;
    //获取打开文件的路径
    m_strFileName=FileDlg.GetPathName();
    //声明文件属性变量
    CFileStatus status;

    CFile::GetStatus(m_strFileName, status);
    //获取文件名
    m_strFullName.Format("文件名: %s",status.m_szFullName);
    //获取文件大小
    m_strSize.Format("文件大小: %d字节",status.m_size);
    //获取文件的创建时间
        m_strCreateTime=status.m_ctime.Format("创建时间: %Y年%m月%d日 %H:%M:%S");
    //获取文件的修改时间
    m_strModifyTime=status.m_mtime.Format("修改时间: %Y年%m月%d日 %H:%M:%S");
    //获取文件的最后访问时间
    m_strAccessTime=status.m_atime.Format("访问时间: %Y年%m月%d日");
    //获取文件属性
    m_strAttribute.Format("属性: %s%s%s%s",
    (status.m_attribute&CFile::readOnly) == CFile::readOnly ? "只读 ":"",
    (status.m_attribute&CFile::hidden) == CFile::hidden ? "隐藏 ":"",
    (status.m_attribute&CFile::system) == CFile::system ? "系统 ":"",
    (status.m_attribute&CFile::archive) == CFile::archive ? "存档 ":"");

    UpdateData(FALSE);
      

  11.   

    自己写解码器,当初我想得到mp3文件中的各种唱片信息也是没办法。。自己按照开放的mp3格式。从内存中把里面的信息读出来
      看来你要研究下.rar格式了。幸好你这还只是一种格式。。我觉得最好。在网络上看下载下代码方式的解码器是最好了。。
      

  12.   


    using System.Windows.Forms;   
    using System;   
    using System.IO;   
      
    ///   
    <SUMMARY>   
    /// This class gets the movie file's details using the windows shell   
    /// </SUMMARY>   
      
    public class MovieFileDetails   
    {   
        private Shell32.Shell Sh = new Shell32.Shell();   
        private Shell32.Folder F;   
        private Shell32.FolderItem FI;   
      
        ///   
    <SUMMARY>   
        /// The runtime (play time) of the movie   
        /// </SUMMARY>   
      
        public readonly string Runtime;   
      
        ///   
    <SUMMARY>   
        /// The screen resolution of movie (Format: Width X Height)   
        /// </SUMMARY>   
      
        public readonly string Resolution;   
      
        ///   
    <SUMMARY>   
        /// The file size in MB of the movie   
        /// </SUMMARY>   
      
        public readonly string FileSize;   
      
        ///   
    <SUMMARY>   
        /// The audio bitrate of the movie (Example: 127kbps)   
        /// </SUMMARY>   
      
        public readonly string Audio;   
      
        ///   
    <SUMMARY>   
        /// Frame rates per second and total bitrate   
        /// </SUMMARY>   
      
        public readonly string Video;   
      
        public MovieFileDetails(string MovieFile)   
        {   
            //Got this using Windows Vista, didnt try it in XP or earlier releases   
            //1 file size = 702 MB   
            //27 length = 01:33:45   
            //28 Audio Bitrate= 127kbps   
            //262 data rate= 3kbps   
            //263 frame height = 416   
            //265 frame rate = 23 frames/second   
            //265 frame width = 560   
            //266 total bitrate = 130kbps   
      
            if (System.IO.File.Exists(MovieFile))   
            {   
                try {   
                    F = Sh.NameSpace(System.IO.Path.GetDirectoryName(MovieFile));   
                    FI = F.ParseName(System.IO.Path.GetFileName(MovieFile));   
      
                    //set the fields   
                    Runtime = F.GetDetailsOf(FI, 27);   
                    Resolution = F.GetDetailsOf(FI, 265) + " X " +   
                        F.GetDetailsOf(FI, 263);   
      
                    //remove formatting, i.e. '701' instead of '701 MB'   
                    FileSize = F.GetDetailsOf(FI, 1).Substring(0,4).Trim();     
      
                    Audio = F.GetDetailsOf(FI, 28);   
                    Video = F.GetDetailsOf(FI, 265) + ", Total BitRate: " +   
                        F.GetDetailsOf(FI,266);   
                }   
                catch (Exception ex) {   
                    const string MSG = "Could not get movie file information. ";   
                    MSG += "Please make sure the right codecs are installed";   
                    MessageBox.Show(MSG, Application.ProductName,   
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);   
                }   
            }   
            else  
            {   
                MessageBox.Show("The file does not exist.", Application.ProductName,   
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);   
            }   
        }   
    }  
    试试这个