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


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

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


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

示例1: BindToFolder

STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
  if (index == ROOT_INDEX_COMPUTER)
  {
    CFSDrives *fsDrivesSpec = new CFSDrives;
    CMyComPtr<IFolderFolder> subFolder = fsDrivesSpec;
    fsDrivesSpec->Init();
    *resultFolder = subFolder.Detach();
  }
  else if (index == ROOT_INDEX_NETWORK)
  {
    CNetFolder *netFolderSpec = new CNetFolder;
    CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
    netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + WCHAR_PATH_SEPARATOR);
    *resultFolder = subFolder.Detach();
  }
  else if (index == ROOT_INDEX_DOCUMENTS)
  {
    UString s = GetMyDocsPath();
    if (!s.IsEmpty())
    {
      NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
      CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
      RINOK(fsFolderSpec->Init(s, NULL));
      *resultFolder = subFolder.Detach();
    }
  }
  else
    return E_INVALIDARG;
  return S_OK;
}
开发者ID:bks,项目名称:qz7,代码行数:31,代码来源:RootFolder.cpp

示例2: BindToParentFolder

STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_parentFolder)
  {
    CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
    *resultFolder = parentFolder.Detach();
    return S_OK;
  }
  if (_netResourcePointer != 0)
  {
    CResourceW resourceParent;
    DWORD result = GetResourceParent(_netResource, resourceParent);
    if (result != NO_ERROR)
      return result;
    if (!_netResource.RemoteNameIsDefined)
      return S_OK;

    CNetFolder *netFolder = new CNetFolder;
    CMyComPtr<IFolderFolder> subFolder = netFolder;
    netFolder->Init(&resourceParent, 0, WCHAR_PATH_SEPARATOR);
    *resultFolder = subFolder.Detach();
  }
  return S_OK;
}
开发者ID:Dabil,项目名称:puNES,代码行数:25,代码来源:NetFolder.cpp

示例3: CreateObject

STDAPI CreateObject(
    const GUID *classID, 
    const GUID *interfaceID, 
    void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;
  if (*classID != CLSID_CBZip2Handler)
    return CLASS_E_CLASSNOTAVAILABLE;
  int needIn = *interfaceID == IID_IInArchive;
  int needOut = *interfaceID == IID_IOutArchive;
  if (needIn || needOut)
  {
    NArchive::NBZip2::CHandler *temp = new NArchive::NBZip2::CHandler;
    if (needIn)
    {
      CMyComPtr<IInArchive> inArchive = (IInArchive *)temp;
      *outObject = inArchive.Detach();
    }
    else
    {
      CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp;
      *outObject = outArchive.Detach();
    }
  }
  else
    return E_NOINTERFACE;
  COM_TRY_END
  return S_OK;
}
开发者ID:BGCX261,项目名称:zipeg-svn-to-git,代码行数:30,代码来源:DllExports.cpp

示例4: BindToParentFolder

STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_parentFolder)
  {
    CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
    *resultFolder = parentFolder.Detach();
    return S_OK;
  }
  if (_path.IsEmpty())
    return E_INVALIDARG;
  int pos = _path.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos < 0 || pos != _path.Length() - 1)
    return E_FAIL;
  UString parentPath = _path.Left(pos);
  pos = parentPath.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos < 0)
  {
    #ifdef UNDER_CE
    *resultFolder = 0;
    #else
    CFSDrives *drivesFolderSpec = new CFSDrives;
    CMyComPtr<IFolderFolder> drivesFolder = drivesFolderSpec;
    drivesFolderSpec->Init();
    *resultFolder = drivesFolder.Detach();
    #endif
    return S_OK;
  }
  UString parentPathReduced = parentPath.Left(pos);
  parentPath = parentPath.Left(pos + 1);
  #ifndef UNDER_CE
  pos = parentPathReduced.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos == 1)
  {
    if (parentPath[0] != WCHAR_PATH_SEPARATOR)
      return E_FAIL;
    CNetFolder *netFolderSpec = new CNetFolder;
    CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
    netFolderSpec->Init(parentPath);
    *resultFolder = netFolder.Detach();
    return S_OK;
  }
  #endif
  CFSFolder *parentFolderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
  RINOK(parentFolderSpec->Init(parentPath, 0));
  *resultFolder = parentFolder.Detach();
  return S_OK;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:49,代码来源:FSFolder.cpp

示例5: RINOK

HRESULT CCoderMixer2ST::GetOutStream(
    ISequentialOutStream **outStreams, const UInt64 **outSizes,
    UInt32 streamIndex, ISequentialOutStream **outStreamRes)
{
  CMyComPtr<ISequentialOutStream> seqOutStream;
  int i;
  for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
    if (_bindInfo.OutStreams[i] == streamIndex)
    {
      seqOutStream = outStreams[i];
      *outStreamRes = seqOutStream.Detach();
      return  S_OK;
    }
  int binderIndex = _bindInfo.FindBinderForOutStream(streamIndex);
  if (binderIndex < 0)
    return E_INVALIDARG;

  UInt32 coderIndex, coderStreamIndex;
  _bindInfo.FindInStream(_bindInfo.BindPairs[binderIndex].InIndex,
      coderIndex, coderStreamIndex);

  CCoderInfo &coder = _coders[coderIndex];
  if (!coder.Coder)
    return E_NOTIMPL;
  coder.Coder.QueryInterface(IID_ISequentialOutStream, &seqOutStream);
  if (!seqOutStream)
    return E_NOTIMPL;

  UInt32 startIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);

  CMyComPtr<ICompressSetOutStream> setOutStream;
  if (!coder.Coder)
    return E_NOTIMPL;
  coder.Coder.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
  if (!setOutStream)
    return E_NOTIMPL;

  if (coder.NumOutStreams > 1)
    return E_NOTIMPL;
  for (i = 0; i < (int)coder.NumOutStreams; i++)
  {
    CMyComPtr<ISequentialOutStream> seqOutStream2;
    RINOK(GetOutStream(outStreams, outSizes, startIndex + i, &seqOutStream2));
    RINOK(setOutStream->SetOutStream(seqOutStream2));
  }
  *outStreamRes = seqOutStream.Detach();
  return S_OK;
}
开发者ID:BIAINC,项目名称:7Zip,代码行数:48,代码来源:CoderMixer2ST.cpp

示例6: GetStream

STDMETHODIMP CPPToJavaArchiveExtractCallback::GetStream(UInt32 index,
                                                        ISequentialOutStream **outStream,
                                                        Int32 askExtractMode) {
    TRACE_OBJECT_CALL("GetStream");

    JNIEnvInstance jniEnvInstance(_jbindingSession);

    if (outStream) {
        *outStream = NULL;
    }

    jobject askExtractModeObject = jni::ExtractAskMode::getExtractAskModeByIndex(jniEnvInstance,
            (jint) askExtractMode);
    if (jniEnvInstance.exceptionCheck()) {
        return S_FALSE;
    }

    // public SequentialOutStream getStream(int index, ExtractAskMode extractAskMode);
    jobject result = _iArchiveExtractCallback->getStream(jniEnvInstance, _javaImplementation,
            (jint) index, askExtractModeObject);
    if (jniEnvInstance.exceptionCheck()) {
        return S_FALSE;
    }

    if (result == NULL) {
        *outStream = NULL;
        return S_OK;
    }

    CMyComPtr<ISequentialOutStream> outStreamComPtr = new CPPToJavaSequentialOutStream(
            _jbindingSession, jniEnvInstance, result);
    *outStream = outStreamComPtr.Detach();

    return S_OK;
}
开发者ID:Esika,项目名称:sevenzipjbinding,代码行数:35,代码来源:CPPToJavaArchiveExtractCallback.cpp

示例7: CreateObject

STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;

  int correctInterface = (*iid == IID_ICompressCoder);
  CMyComPtr<ICompressCoder> coder;
  if (*clsid == CLSID_CCompressRar15Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar15::CDecoder;
  }
  else if (*clsid == CLSID_CCompressRar20Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar20::CDecoder;
  }
  else if (*clsid == CLSID_CCompressRar29Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar29::CDecoder;
  }
  else
    return CLASS_E_CLASSNOTAVAILABLE;
  *outObject = coder.Detach();
  COM_TRY_END
  return S_OK;
}
开发者ID:BGCX261,项目名称:zipeg-svn-to-git,代码行数:31,代码来源:DllExports.cpp

示例8: Clone

STDMETHODIMP CAltStreamsFolder::Clone(IFolderFolder **resultFolder)
{
  CAltStreamsFolder *folderSpec = new CAltStreamsFolder;
  CMyComPtr<IFolderFolder> folderNew = folderSpec;
  folderSpec->Init(_pathPrefix);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
开发者ID:SaketaChalamchala,项目名称:DisassemblyAccuracy,代码行数:8,代码来源:AltStreamsFolder.cpp

示例9: BindToParentFolder

STDMETHODIMP CAgentFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  COM_TRY_BEGIN
  CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
  *resultFolder = parentFolder.Detach();
  return S_OK;
  COM_TRY_END
}
开发者ID:f059074251,项目名称:interested,代码行数:8,代码来源:Agent.cpp

示例10: Clone

STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
{
  CFSFolder *fsFolderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> folderNew = fsFolderSpec;
  fsFolderSpec->Init(_path, 0);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
开发者ID:bks,项目名称:qz7,代码行数:8,代码来源:FSFolder.cpp

示例11: Clone

STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder)
{
  CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
  CMyComPtr<IFolderFolder> folderNew = folderSpec;
  folderSpec->Init(_path);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
开发者ID:BIAINC,项目名称:7Zip,代码行数:8,代码来源:PhysDriveFolder.cpp

示例12: GetStream

STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
{
  COM_TRY_BEGIN
  *stream = 0;
  UInt64 blockIndex;
  UInt64 currentItemSize;
  
  if (index < _archive.Refs.Size())
  {
    const CRef &ref = _archive.Refs[index];
    const CDir &item = ref.Dir->_subItems[ref.Index];
    if (item.IsDir())
      return S_FALSE;

    if (ref.NumExtents > 1)
    {
      CExtentsStream *extentStreamSpec = new CExtentsStream();
      CMyComPtr<ISequentialInStream> extentStream = extentStreamSpec;
      
      extentStreamSpec->Stream = _stream;
      
      UInt64 virtOffset = 0;
      for (UInt32 i = 0; i < ref.NumExtents; i++)
      {
        const CDir &item2 = ref.Dir->_subItems[ref.Index + i];
        if (item2.Size == 0)
          continue;
        CSeekExtent se;
        se.Phy = (UInt64)item2.ExtentLocation * kBlockSize;
        se.Virt = virtOffset;
        extentStreamSpec->Extents.Add(se);
        virtOffset += item2.Size;
      }
      if (virtOffset != ref.TotalSize)
        return S_FALSE;
      CSeekExtent se;
      se.Phy = 0;
      se.Virt = virtOffset;
      extentStreamSpec->Extents.Add(se);
      extentStreamSpec->Init();
      *stream = extentStream.Detach();
      return S_OK;
    }
    
    currentItemSize = item.Size;
    blockIndex = item.ExtentLocation;
  }
  else
  {
    unsigned bootIndex = index - _archive.Refs.Size();
    const CBootInitialEntry &be = _archive.BootEntries[bootIndex];
    currentItemSize = _archive.GetBootItemSize(bootIndex);
    blockIndex = be.LoadRBA;
  }
  
  return CreateLimitedInStream(_stream, (UInt64)blockIndex * kBlockSize, currentItemSize, stream);
  COM_TRY_END
}
开发者ID:w17,项目名称:7-Zip-zstd,代码行数:58,代码来源:IsoHandler.cpp

示例13: BindToFolderSpec

HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  CFSFolder *folderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = folderSpec;
  RINOK(folderSpec->Init(_path + name + UString(WCHAR_PATH_SEPARATOR), 0));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
开发者ID:bks,项目名称:qz7,代码行数:9,代码来源:FSFolder.cpp

示例14: BindToFolderSpec

HRESULT CFSFolder::BindToFolderSpec(CFSTR name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  CFSFolder *folderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = folderSpec;
  RINOK(folderSpec->Init(_path + name + FCHAR_PATH_SEPARATOR));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
开发者ID:cube-soft,项目名称:7z,代码行数:9,代码来源:FSFolder.cpp

示例15: BindToFolderSpec

HRESULT CFSDrives::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_volumeMode)
    return S_OK;
  NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
  RINOK(fsFolderSpec->Init(name, 0));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:11,代码来源:FSDrives.cpp


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