本文整理汇总了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);
}
示例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;
}