当前位置: 首页>>代码示例>>C++>>正文


C++ CMyComPtr::GetExtensions方法代码示例

本文整理汇总了C++中CMyComPtr::GetExtensions方法的典型用法代码示例。如果您正苦于以下问题:C++ CMyComPtr::GetExtensions方法的具体用法?C++ CMyComPtr::GetExtensions怎么用?C++ CMyComPtr::GetExtensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMyComPtr的用法示例。


在下文中一共展示了CMyComPtr::GetExtensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetIconPath

static UString GetIconPath(const UString &filePath,
    const CLSID &clsID, const UString &extension, Int32 &iconIndex)
{
  CPluginLibrary library;
  CMyComPtr<IFolderManager> folderManager;
  CMyComPtr<IFolderFolder> folder;
  if (filePath.IsEmpty())
    folderManager = new CArchiveFolderManager;
  else if (library.LoadAndCreateManager(filePath, clsID, &folderManager) != S_OK)
    return UString();
  CMyComBSTR extBSTR;
  if (folderManager->GetExtensions(&extBSTR) != S_OK)
    return UString();
  const UString ext2 = (const wchar_t *)extBSTR;
  UStringVector exts;
  SplitString(ext2, exts);
  for (int i = 0; i < exts.Size(); i++)
  {
    const UString &plugExt = exts[i];
    if (extension.CompareNoCase((const wchar_t *)plugExt) == 0)
    {
      CMyComBSTR iconPathTemp;
      if (folderManager->GetIconPath(plugExt, &iconPathTemp, &iconIndex) != S_OK)
        break;
      if (iconPathTemp != 0)
        return (const wchar_t *)iconPathTemp;
    }
  }
  return UString();
}
开发者ID:BIAINC,项目名称:7Zip,代码行数:30,代码来源:SystemPage.cpp

示例2: Read

void CExtDatabase::Read()
{
  CObjectVector<CExtInfo> extItems;
  ReadInternalAssociations(extItems);
  ReadFileFolderPluginInfoList(Plugins);
  for (int i = 0; i < extItems.Size(); i++)
  {
    const CExtInfo &extInfo = extItems[i];
    CExtInfoBig extInfoBig;
    extInfoBig.Ext = extInfo.Ext;
    extInfoBig.Associated = false;
    for (int p = 0; p < extInfo.Plugins.Size(); p++)
    {
      int pluginIndex = FindPlugin(extInfo.Plugins[p]);
      if (pluginIndex >= 0)
        extInfoBig.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, true));
    }
    ExtBigItems.Add(extInfoBig);
  }
  for (int pluginIndex = 0; pluginIndex < Plugins.Size(); pluginIndex++)
  {
    const CPluginInfo &pluginInfo = Plugins[pluginIndex];

    CPluginLibrary pluginLibrary;
    CMyComPtr<IFolderManager> folderManager;

    if (pluginInfo.FilePath.IsEmpty())
      folderManager = new CArchiveFolderManager;
    else if (pluginLibrary.LoadAndCreateManager(pluginInfo.FilePath,
         pluginInfo.ClassID, &folderManager) != S_OK)
      continue;
    CMyComBSTR extBSTR;
    if (folderManager->GetExtensions(&extBSTR) != S_OK)
      return;
    const UString ext2 = (const wchar_t *)extBSTR;
    UStringVector exts;
    SplitString(ext2, exts);
    for (int i = 0; i < exts.Size(); i++)
    {
      const UString &ext = exts[i];
      int index = FindExtInfoBig(ext);
      if (index < 0)
      {
        CExtInfoBig extInfo;
        extInfo.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, false));
        extInfo.Associated = false;
        extInfo.Ext = ext;
        ExtBigItems.Add(extInfo);
      }
      else
      {
        CExtInfoBig &extInfo = ExtBigItems[index];
        int pluginIndexIndex = extInfo.FindPlugin(pluginIndex);
        if (pluginIndexIndex < 0)
          extInfo.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, false));
      }
    }
  }
}
开发者ID:bks,项目名称:qz7,代码行数:59,代码来源:FilePlugins.cpp


注:本文中的CMyComPtr::GetExtensions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。