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


C++ CComObject::GetUnknown方法代码示例

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


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

示例1: insertSubPath

STDMETHODIMP CPDPath::insertSubPath(long index, IPDSubPath *subPath)
{
	if (subPath == NULL) return E_INVALIDARG;

	CComObject<CPDSubPath>* pSubPath = (CComObject<CPDSubPath>*)subPath;

	pSubPath->AddRef();

// Remove first from previous path
	if (pSubPath->m_pOwnerPath != NULL)
	{
		pSubPath->m_pOwnerPath->removeSubPath(pSubPath);
	}

	pSubPath->m_pOwnerPath = this;

	DWORD cookie;
	pSubPath->Advise(this, &cookie);

	if (index < 0)
		m_subPaths.Add(pSubPath);
	else
		m_subPaths.InsertAt(index, pSubPath);

	FireOnChanged(NOTIFY_ADD, pSubPath->GetUnknown(), DISPID_UNKNOWN);

	return S_OK;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: OnAdvise

void CMDriveDlg::OnAdvise()
{
	if (m_nAdviseCnt < m_nMaxAdvises)
	{
		CComObject<CDriver>* pDriver;
		CComObject<CDriver>::CreateInstance(&pDriver);
		pDriver->m_nID = m_nAdviseCnt;
		HRESULT hRes = AtlAdvise(pRandom, pDriver->GetUnknown(), IID_IRandomEvent, &m_arrAdvise[m_nAdviseCnt++]);
		if (FAILED(hRes))
		{
			AfxMessageBox("Advise failed");
			m_nAdviseCnt--;
		}
	}
	else
		AfxMessageBox("No more advises");
}
开发者ID:jetlive,项目名称:skiaming,代码行数:17,代码来源:drivedlg.cpp

示例3: _GetCommand

HRESULT CExplorerCommandProvider::_GetCommand(HMENU hMenu, UINT uMenuID, REFIID riid, LPVOID* ppRetVal)
{
   // NOTE: We grab the menu-information here, including its title. The string
   //       buffer is local and since we intend to store a copy for each Command item
   //       we'll have to transfer the text to a buffer there too.
   WCHAR wszTitle[100] = { 0 };
   MENUITEMINFO mii = { 0 };
   mii.cbSize = sizeof(mii);
   mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE | MIIM_STRING | MIIM_SUBMENU;
   mii.dwTypeData = wszTitle;
   mii.cch = lengthof(wszTitle) - 1;
   if( !::GetMenuItemInfo(hMenu, uMenuID, FALSE, &mii) ) return E_FAIL;
   CComObject<CExplorerCommand>* pCommand = NULL;
   HR( CComObject<CExplorerCommand>::CreateInstance(&pCommand) );
   CComPtr<IUnknown> spKeepAlive = pCommand->GetUnknown();
   HR( pCommand->Init(this, mii) );
   return pCommand->QueryInterface(riid, ppRetVal);
}
开发者ID:imwuzhh,项目名称:repo1,代码行数:18,代码来源:CommandProvider.cpp

示例4: Initialize


//.........这里部分代码省略.........
	{
		return;
	}

	// Create remote host which implements IServiceProvider and IWMPRemoteMediaServices
	if (SUCCEEDED(hr))
	{
		hr = CComObject<CRemoteHost>::CreateInstance(&pRemoteHost);
		if (pRemoteHost)
		{
			pRemoteHost->AddRef();
			pRemoteHost->m_Player = this;
		}
		else
		{
			hr = E_POINTER;
		}
	}

	// Set site to the remote host
	if (SUCCEEDED(hr))
	{
		hr = spHostObject->SetSite((IWMPRemoteMediaServices*)pRemoteHost);
	}

	if (SUCCEEDED(hr))
	{
		hr = m_AxWindow->QueryHost(&spHost);
		if (!spHost)
		{
			hr = E_NOINTERFACE;
		}
	}

	// Create WMP control
	if (SUCCEEDED(hr))
	{
		hr = spHost->CreateControl(L"{6BF52A52-394A-11D3-B153-00C04F79FAA6}", m_AxWindow->m_hWnd, NULL);
	}

	if (SUCCEEDED(hr))
	{
		hr = m_AxWindow->QueryControl(&m_IPlayer);
		if (!m_IPlayer.p)
		{
			hr = E_NOINTERFACE;
		}
	}

	// Connect the event interface
	CComPtr<IConnectionPointContainer> spConnectionContainer;
	hr = m_IPlayer->QueryInterface(&spConnectionContainer);

	if (SUCCEEDED(hr))
	{
		hr = spConnectionContainer->FindConnectionPoint( __uuidof(IWMPEvents), &m_IConnectionPoint);
	}

	if (SUCCEEDED(hr))
	{
		DWORD adviseCookie;
		hr = m_IConnectionPoint->Advise(pRemoteHost->GetUnknown(), &adviseCookie);

		if ((FAILED(hr)) || !adviseCookie)
		{
			m_IConnectionPoint = NULL;
		}
	}

	// Release remote host object
	if (pRemoteHost)
	{
		pRemoteHost->Release();
	}

	hr = m_IPlayer->get_controls(&m_IControls);
	if (FAILED(hr)) return;

	hr = m_IPlayer->get_settings(&m_ISettings);
	if (FAILED(hr)) return;

	// Get player state
	WMPPlayState state;
	m_IPlayer->get_playState(&state);
	if (state == wmppsPlaying)
	{
		m_State = STATE_PLAYING;
	}
	else if (state ==  wmppsPaused)
	{
		m_State = STATE_PAUSED;
	}

	if (m_State != STATE_STOPPED)
	{
		m_TrackChanged = true;
	}

	m_Initialized = true;
}
开发者ID:testaccountx,项目名称:testrepo,代码行数:101,代码来源:PlayerWMP.cpp

示例5: OnItemDblClick

void __stdcall CEXMLDocumentStyleSheetsView::OnItemDblClick(IUITreeItem* item)
{
	DWORD itemdata;
	m_treeCtl->GetItemInfo(item, &itemdata, NULL, NULL);

	CComQIPtr<ILDOMNode> node = (IUnknown*)itemdata;

	CComQIPtr<ILDOMElement> element = node;

	if (element)
	{
		CComPtr<IEElement> eElement;
		m_viewGroup->m_pDocument->GetEElementFromDOMElement(element, &eElement);

		CEStyleElement* pStyleElement = static_cast<CEStyleElement*>(eElement.p);

		CComQIPtr<ILLinkStyle> linkStyle = node;

		CComPtr<ILCSSStyleSheet> styleSheet;
		linkStyle->get_sheet((ILStyleSheet**)&styleSheet);

		{
			ASSERT(0);
#if 0
			CComQIPtr<ILXAddin> addin = m_viewGroup->m_pDocument->m_app;

			WCHAR buf[512];
			swprintf(buf, L"%s/style", (BSTR)m_viewGroup->m_pDocument->m_fileTitle);

			pStyleElement->m_pCSSDocument->m_fileTitle = buf;
			pStyleElement->m_pCSSDocument->m_app = addin;
			pStyleElement->m_pCSSDocument->m_styleSheet = styleSheet;

			CComPtr<ILXAddinSite> addinSite;
			addin->GetSite(&addinSite);

			CComPtr<ILXFrameworkFrame> lxframe;
			addinSite->GetFrame(&lxframe);

			CComQIPtr<IEFrame> eframe = lxframe;

			pStyleElement->m_pCSSDocument->ShowViews(eframe);
#endif
		}
	}

	CComQIPtr<ILLinkStyle> linkStyle = node;

	if (linkStyle)
	{
	}

#if 0
	CComPtr<ILCSSStyleSheet> openStyleSheet;

	CComQIPtr<ILCSSStyleSheet> styleSheet = (IUnknown*)itemdata;
	CComQIPtr<ILCSSRule> rule = (IUnknown*)itemdata;
	if (styleSheet)
	{
		CComBSTR href;
		styleSheet->get_href(&href);
		if (href.Length())
		{
			openStyleSheet = styleSheet;
		}
	}
	else if (rule)
	{
		CComQIPtr<ILCSSImportRule> importRule = rule;
		if (importRule)
		{
			importRule->get_styleSheet(&openStyleSheet);
		}
	}

	if (openStyleSheet)
	{
		CComObject<CECSSDocument>* pCSSDocument;
		CComObject<CECSSDocument>::CreateInstance(&pCSSDocument);
		if (pCSSDocument)
		{
			pCSSDocument->m_styleSheet = openStyleSheet;

			BSTR cssText;
			openStyleSheet->get_cssText(&cssText);
			pCSSDocument->m_textData->put_data(cssText);

#if 0
			AddDocument(pCSSDocument->GetUnknown(), NULL);
#endif
		}
	}
#endif
}
开发者ID:,项目名称:,代码行数:94,代码来源:


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