【问题标题】:Win7 namespace extension determine if IShellItem is file or folderWin7 命名空间扩展判断 IShellItem 是文件还是文件夹
【发布时间】:2014-03-29 07:52:31
【问题描述】:

我正在为 Windows 7 开发某种命名空间扩展。我的扩展在上下文菜单中为所有文件和文件夹提供了一些特定于应用程序的内容。但我想以不同的方式处理文件和文件夹。有没有办法判断IShellItem提供接口对象是文件夹还是文件?

【问题讨论】:

    标签: c++ windows com explorer


    【解决方案1】:

    你可以使用IShellItem::GetAttributes method,像这样:

    SFGAOF att = 0;
    if (SUCCEEDED(pItem->GetAttributes(SFGAO_FOLDER, &att))) // pItem is a IShellItem*
    {
        if (att & SFGAO_FOLDER)
        {
            // it's a folder
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-12
      • 2013-01-11
      相关资源
      最近更新 更多