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


C++ IDispatchPtr::GetInterfacePtr方法代码示例

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


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

示例1:

HRESULT
nsScriptablePeer::GetIDispatch(IDispatch **pdisp)
{
    if (pdisp == NULL)
    {
        return E_INVALIDARG;
    }
    *pdisp = NULL;

    IUnknownPtr unk;
    HRESULT hr = mPlugin->pControlSite->GetControlUnknown(&unk);
    if (unk.GetInterfacePtr() == NULL)
    {
		return E_FAIL; 
	}

    IDispatchPtr disp = unk;
    if (disp.GetInterfacePtr() == NULL)
    { 
        return E_FAIL; 
    }

    *pdisp = disp.GetInterfacePtr();
    (*pdisp)->AddRef();

    return S_OK;
}
开发者ID:pauldorn,项目名称:v8monkey,代码行数:27,代码来源:XPConnect.cpp

示例2: TestNewInstance

void TestPowerPointControllerImpl::TestNewInstance()
{	
	IDispatchPtr spApplication(_T("PowerPoint.Application"));
	assertMessage(spApplication != NULL, _T("Failed to create an instance of [PowerPoint.Application]"));

	CControllerImplPtr spImplementor(CreateImplementor());	
	spImplementor->m_bUseExistingInstance = false;
	spImplementor->Initialize();

	IDispatchPtr spHostApplication = spImplementor->GetApplication();	
	assertMessage(spHostApplication.GetInterfacePtr() != spApplication.GetInterfacePtr(), _T("CPowerPointControllerImpl::GetApplication did not create a new instance of PowerPoint."));	
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:12,代码来源:TestPowerPointControllerImpl.cpp

示例3: TestUseExistingInstance

void TestPowerPointControllerImpl::TestUseExistingInstance()
{	
	IDispatchPtr spApplication(_T("PowerPoint.Application"));
	assertMessage(spApplication != NULL, _T("Failed to create an instance of [PowerPoint.Application]"));

	CControllerImplPtr spImplementor(CreateImplementor());	
	spImplementor->m_bUseExistingInstance = true;
	spImplementor->Initialize();

	IDispatchPtr spHostApplication = spImplementor->GetApplication();
	// There is a problem getting the current instance of PowerPoint 97; hence the instance returned will be nil.
	assertMessage(spHostApplication.GetInterfacePtr() != spApplication.GetInterfacePtr(), _T("CPowerPointControllerImpl::GetApplication should not return the existing instance of PowerPoint 97."));	
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:TestPowerPointControllerImpl.cpp

示例4: PopulateContextItemsEx

HRESULT CSaveAsObject::PopulateContextItemsEx(IContextItemsPtr& pContextItems, DocProviderWorker* pWorker, IManDocumentPtr& pBaseDocument, long lFormatIndex, const CStdString& sFormatString, const CStdString& sDescription, IManSessionPtr& pSession, const CStdString& sFilename)
{
	HRESULT hr = E_FAIL;
	try
	{
		hr = pContextItems.CreateInstance(__uuidof(ContextItems));
		if(pContextItems == NULL)
		{
			LOG_WS_ERROR(_T("Context object is null"))	;
			return hr;
		}

		IManDatabasePtr pDatabase;
		if (NULL != pBaseDocument)
		{
			pDatabase = pBaseDocument->Database;
		}
		else
		{
			pDatabase = pSession->PreferredDatabase;
		}

		// Makes IW bring up supplemental dialog for .doc files if this line is omitted -> find out why IB/JC removed it
		_bstr_t bstrAppType = GetApplicationIDFromFileName(pDatabase, sFilename);
		PopulateContextItems(pContextItems, L"IManExt.Import.DocType", bstrAppType);

		if (!m_hWnd)
		{
			m_hWnd = GetDesktopWindow();
		}
		hr = PopulateContextItems(pContextItems, L"ParentWindow", (long)m_hWnd);
		if (FAILED(hr))
		{
			return hr;
		}

		IDispatchPtr pDMSDisp = pWorker->GetSessionsMgr()->GetNRTDMS().GetInterfacePtr();
		if (pDMSDisp == NULL)
		{
			LOG_WS_ERROR(_T("QI for NRTDMS failed"));
			return S_FALSE;
		}

		hr = PopulateContextItems(pContextItems, L"IManDMS", pDMSDisp.GetInterfacePtr());
		if (FAILED(hr))
		{
			return hr;
		}

		hr = PopulateContextItems(pContextItems, L"IManExt.Import.DocDescription", (LPCTSTR) sDescription);
		if (FAILED(hr))
		{
			return hr;
		}

		hr = PopulateContextItems(pContextItems, L"IManExt.Import.InheritSecurity", _T("True"));
		if (FAILED(hr))
		{
			return hr;
		}
					
		if(IsAutoProfiling())
		{		
			hr = PopulateContextItems(pContextItems, L"IManExt.Import.DocAuthor", pSession->GetUserID());
			if (FAILED(hr))
			{
				return hr;
			}

			CStdString sDefaultDocClass = L"doc";
			CStdString sAlternateFlagName = m_bConversion ? L"InterwovenUseConversionAlternateClassName" : L"InterwovenUseAlternateClassName";
			CStdString sAlternateOptionClassName = m_bConversion ? L"InterwovenConversionAlternateClassName" : L"InterwovenAlternateClassName";
			if (Workshare::OptionApi::GetBool(sAlternateFlagName))
			{
				CStdString sClass = Workshare::OptionApi::GetString(sAlternateOptionClassName);
				if (!sClass.IsEmpty())
					sDefaultDocClass = sClass;
			}

			hr = PopulateContextItems(pContextItems, L"IManExt.Import.DocClass", (LPCTSTR) sDefaultDocClass);
			if (FAILED(hr))
			{
				return hr;
			}
			
			hr = PopulateContextItems(pContextItems, L"IManExt.Import.DocSubclass", (LPCTSTR) CIManageUtils::GetSubClassName(pDatabase, sDefaultDocClass));
			if (FAILED(hr))
			{
				return hr;
			}
			
			if ((pBaseDocument == NULL) && !m_sBaseFolderPath.IsEmpty())
			{
				PopulateContextItems(pContextItems, L"IManExt2.DefaultLocation", m_sBaseFolderPath.c_str());
			}
		}

		CSDSafeArray SDSafeArray;
		long lVectorIndex = CreateFileTypesSafeArray(sFormatString, SDSafeArray, lFormatIndex);

//.........这里部分代码省略.........
开发者ID:killbug2004,项目名称:WSProf,代码行数:101,代码来源:SaveAsObject.cpp


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