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


C++ IOleObject::GetClientSite方法代码示例

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


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

示例1: OleSetOleError

// @pymethod |PyIOleObject|GetClientSite|Description of GetClientSite.
PyObject *PyIOleObject::GetClientSite(PyObject *self, PyObject *args)
{
	IOleObject *pIOO = GetI(self);
	if ( pIOO == NULL )
		return NULL;
	IOleClientSite * ppClientSite;
	if ( !PyArg_ParseTuple(args, ":GetClientSite") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOO->GetClientSite( &ppClientSite );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	return PyCom_PyObjectFromIUnknown(ppClientSite, IID_IOleClientSite, FALSE);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyIOleObject.cpp

示例2: CopySmile

bool CGifSmileyCtrl::CopySmile( long hwndHostWindow, BSTR bstrFileName, OLE_COLOR clr, INT cy)
{
	COLORREF backColor = (COLORREF)(clr);
	HWND hwnd = (HWND)(hwndHostWindow);
	HRESULT hr; 

	LPOLECLIENTSITE pOleSite;
	LPOLEOBJECT	lpObject=NULL;
	LPLOCKBYTES lpLockBytes = NULL;  

	// retrieve OLE interface for richedit  

	try
	{ 

		IOleObject *lpOleObject = NULL;    //OLE object
		QueryInterface(IID_IOleObject,(void**)&lpOleObject); 
		lpOleObject->GetClientSite(&pOleSite);

		//Load the gif
		LoadFromFileSized(bstrFileName, 0,cy);

		//Set back color
		OLE_COLOR oleBackColor=(OLE_COLOR)backColor;
		m_clrBackColor = oleBackColor;
		put_BackColor(oleBackColor);
		//myObject->put_BackColor(oleBackColor);

		//get the IOleObject
		hr = QueryInterface(IID_IOleObject, (void**)&lpObject);
		if (FAILED(hr))
		{
			return	 false;
		}

		//to insert into richedit, you need a struct of REOBJECT
		REOBJECT reobject;
		ZeroMemory(&reobject, sizeof(REOBJECT));

		reobject.cbStruct = sizeof(REOBJECT);	

		CLSID clsid;
		hr =  lpObject->GetUserClassID(&clsid);


		//set clsid
		reobject.clsid = clsid;
		//can be selected
		reobject.cp = REO_CP_SELECTION;
		//content, but not static
		reobject.dvaspect = DVASPECT_CONTENT;
		//goes in the same line of text line
		reobject.dwFlags = REO_BELOWBASELINE;
		reobject.dwUser = (DWORD)this;
		//the very object
		reobject.poleobj = lpObject;
		//client site contain the object
		reobject.polesite = pOleSite;
		//the storage 
		reobject.pstg = NULL;

		SIZEL sizel={0};
		reobject.sizel = sizel; 
		hr = SetHostWindow((long)hwnd, 0);

		//ole->InsertObject(&reobject);

		//redraw the window to show animation
		::RedrawWindow(hwnd,NULL, NULL, RDW_INVALIDATE);

		if (pOleSite)
		{
			pOleSite->Release();
			pOleSite = NULL;
		}
		if (lpObject)
		{
			lpObject->Release();
			lpObject = NULL;
		} 
	}
	catch( ... )
	{
		if (pOleSite)
		{
			pOleSite->Release();
			pOleSite = NULL;
		}
		if (lpObject)
		{
			lpObject->Release();
			lpObject = NULL;
		} 
		return FALSE;
	}
	return S_OK;
}
开发者ID:0359xiaodong,项目名称:TeamTalk,代码行数:97,代码来源:GifSmileyCtrl.cpp


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