本文整理汇总了C++中PyCom_InterfaceFromPyInstanceOrObject函数的典型用法代码示例。如果您正苦于以下问题:C++ PyCom_InterfaceFromPyInstanceOrObject函数的具体用法?C++ PyCom_InterfaceFromPyInstanceOrObject怎么用?C++ PyCom_InterfaceFromPyInstanceOrObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PyCom_InterfaceFromPyInstanceOrObject函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetI
// @pymethod (int, <o PyIShellItem>|PyITransferSource|RecycleItem|Moves an item to the recycle bin
PyObject *PyITransferSource::RecycleItem(PyObject *self, PyObject *args)
{
ITransferSource *pITS = GetI(self);
if ( pITS == NULL )
return NULL;
// @pyparm <o PyIShellItem>|Source||The item to be recycled
// @pyparm <o PyIShellItem>|ParentDest||Shell item representing the recycle bin
TRANSFER_SOURCE_FLAGS flags;
// @pyparm int|flags||Combination of shellcon.TSF_* flags
PyObject *obpsiSource;
PyObject *obpsiParentDest;
IShellItem * psiSource;
IShellItem * psiParentDest;
IShellItem * ppsiNewDest;
if ( !PyArg_ParseTuple(args, "OOi:RecycleItem", &obpsiSource, &obpsiParentDest, &flags) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiSource, IID_IShellItem, (void **)&psiSource, FALSE))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiParentDest, IID_IShellItem, (void **)&psiParentDest, FALSE)){
PYCOM_RELEASE(psiSource);
return NULL;
}
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pITS->RecycleItem( psiSource, psiParentDest, flags, &ppsiNewDest );
psiSource->Release();
psiParentDest->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pITS, IID_ITransferSource );
return Py_BuildValue("lO", hr, PyCom_PyObjectFromIUnknown(ppsiNewDest, IID_IShellItem, FALSE));
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:34,代码来源:PyITransferSource.cpp
示例2: InvokeViaPolicy
STDMETHODIMP PyGEnumDebugStackFrames::Next(
/* [in] */ ULONG celt,
/* [length_is][size_is][out] */ DebugStackFrameDescriptor __RPC_FAR *rgVar,
/* [out] */ ULONG __RPC_FAR *pCeltFetched)
{
PY_GATEWAY_METHOD;
PyObject *result;
Py_ssize_t len;
HRESULT hr = InvokeViaPolicy("Next", &result, "i", celt);
if ( FAILED(hr) )
return hr;
if ( !PySequence_Check(result) )
goto error;
len = PyObject_Length(result);
if ( len == -1 )
goto error;
if ( len > (Py_ssize_t)celt)
len = celt;
if ( pCeltFetched )
*pCeltFetched = PyWin_SAFE_DOWNCAST(len, Py_ssize_t, ULONG);
Py_ssize_t i;
for ( i = 0; i < len; ++i )
{
PyObject *ob = PySequence_GetItem(result, i);
if ( ob == NULL )
goto error;
if (!PyTuple_Check(ob)) {
Py_DECREF(ob);
PyErr_SetString(PyExc_TypeError, "PyIEnumDebugStackFrames::Next must return a tuple.");
goto error;
}
PyObject *obEnum, *obUnk;
if (!PyArg_ParseTuple(ob, "OiiiO", &obEnum, &rgVar[i].dwMin, &rgVar[i].dwLim, &rgVar[i].fFinal, &obUnk)) {
Py_DECREF(ob);
goto error;
}
if ( !PyCom_InterfaceFromPyInstanceOrObject(obEnum, IID_IDebugStackFrame, (void **)&rgVar[i].pdsf, FALSE) ||
!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&rgVar[i].punkFinal, TRUE) )
{
Py_DECREF(ob);
Py_DECREF(result);
return PyCom_SetCOMErrorFromPyException(IID_IEnumDebugStackFrames);
}
Py_DECREF(ob);
}
Py_DECREF(result);
return len < (Py_ssize_t)celt ? S_FALSE : S_OK;
error:
hr = PyErr_Occurred() ? PyCom_SetCOMErrorFromPyException(IID_IEnumDebugStackFrames)
: PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumDebugStackFrames);
Py_DECREF(result);
return hr;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:60,代码来源:PyIEnumDebugStackFrames.cpp
示例3: GetI
// @pymethod |PyINameSpaceTreeControl|AppendRoot|Description of AppendRoot.
PyObject *PyINameSpaceTreeControl::AppendRoot(PyObject *self, PyObject *args)
{
INameSpaceTreeControl *pINSTC = GetI(self);
if ( pINSTC == NULL )
return NULL;
// @pyparm <o PyIShellItem>|psiRoot||Description for psiRoot
// @pyparm int|grfEnumFlags||Description for grfEnumFlags
// @pyparm int|grfRootStyle||Description for grfRootStyle
// @pyparm <o PyIShellItemFilter>|pif||Description for pif
PyObject *obpsiRoot;
PyObject *obpif;
IShellItem * psiRoot;
DWORD grfEnumFlags;
DWORD grfRootStyle;
IShellItemFilter * pif;
if ( !PyArg_ParseTuple(args, "OkkO:AppendRoot", &obpsiRoot, &grfEnumFlags, &grfRootStyle, &obpif) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiRoot, IID_IShellItem, (void **)&psiRoot, TRUE /* bNoneOK */))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpif, IID_IShellItemFilter, (void **)&pif, TRUE /* bNoneOK */)) {
if (pif) pif->Release();
return NULL;
}
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pINSTC->AppendRoot( psiRoot, grfEnumFlags, grfRootStyle, pif );
if (psiRoot) psiRoot->Release();
if (pif) pif->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pINSTC, IID_INameSpaceTreeControl );
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:35,代码来源:PyINameSpaceTreeControl.cpp
示例4: GetI
// @pymethod |PyIDebugApplication|FireDebuggerEvent|Fire a generic event to the IApplicationDebugger (if any)
PyObject *PyIDebugApplication::FireDebuggerEvent(PyObject *self, PyObject *args)
{
PY_INTERFACE_METHOD;
IDebugApplication *pIDA = GetI(self);
if ( pIDA == NULL )
return NULL;
// @pyparm <o PyIIID>|guid||A GUID.
// @pyparm <o PyIUnknown>|unknown||An unknown object.
PyObject *obguid, *obunk;
if ( !PyArg_ParseTuple(args, "OO:FireDebuggerEvent", &obguid, &obunk) )
return NULL;
BOOL bPythonIsHappy = TRUE;
IUnknown *punk;
IID iid;
if (!PyWinObject_AsIID(obguid, &iid))
bPythonIsHappy = FALSE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obunk, IID_IUnknown, (void **)&punk, FALSE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pIDA->FireDebuggerEvent( iid, punk );
punk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return SetPythonCOMError(self,hr);
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:29,代码来源:PyIDebugApplication.cpp
示例5: GetI
// @pymethod interface|PyIShellItem|BindToHandler|Creates an instance of one of the item's handlers
PyObject *PyIShellItem::BindToHandler(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
// @pyparm <o PyIBindCtx>|pbc||Used to pass parameters that influence the binding operation, can be None
// @pyparm <o PyIID>|bhid||GUID that identifies a handler (shell.BHID_*)
// @pyparm <o PyIID>|riid||The interface to return
PyObject *obpbc;
PyObject *obbhid;
PyObject *obriid;
IBindCtx *pbc;
IID bhid;
IID riid;
void *pv;
if ( !PyArg_ParseTuple(args, "OOO:BindToHandler", &obpbc, &obbhid, &obriid) )
return NULL;
if (!PyWinObject_AsIID(obbhid, &bhid))
return NULL;
if (!PyWinObject_AsIID(obriid, &riid))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISI->BindToHandler( pbc, bhid, riid, &pv );
if (pbc) pbc->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:35,代码来源:PyIShellItem.cpp
示例6: SetPythonCOMError
// @pymethod int|PyIConnectionPoint|Advise|Establishes a connection between the connection point object and the client's sink.
PyObject *PyIConnectionPoint::Advise(PyObject *self, PyObject *args)
{
PyObject *obUnk;
// @pyparm <o PyIUnknown>|unk||The client's advise sink
if ( !PyArg_ParseTuple(args, "O:Advise", &obUnk) )
return NULL;
IUnknown *pUnk;
if (!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&pUnk, FALSE))
return NULL;
IConnectionPoint *pICP = GetI(self);
if ( pICP == NULL )
return NULL;
DWORD cookie;
PY_INTERFACE_PRECALL;
HRESULT hr = pICP->Advise( pUnk, &cookie );
pUnk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return SetPythonCOMError(self,hr);
// @rdesc The result is the connection point identifier used by <om PyIConnectionPoint::Unadvise>
return PyInt_FromLong(cookie);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:26,代码来源:PyIConnectionPoint.cpp
示例7: GetI
// @pymethod int|PyIDropTarget|DragEnter|Called when an object is initially dragged into a window
// @rdesc Your implementation of this function should return a shellcon.DROPEFFECT_* value indicating if the object can be accepted
PyObject *PyIDropTarget::DragEnter(PyObject *self, PyObject *args)
{
IDropTarget *pIDT = GetI(self);
if ( pIDT == NULL )
return NULL;
// @pyparm <o PyIDataObject>|pDataObj||IDataObject interface that contains the object being dragged
// @pyparm int|grfKeyState||Combination of win32con.MK_* flags containing keyboard modifier state
POINTL pt;
PyObject *obpt;
// @pyparm (int, int)|pt||(x,y) Screen coordinates of cursor
PyObject *obpDataObj;
IDataObject *pDataObj;
DWORD grfKeyState;
DWORD dwEffect;
// @pyparm int|pdwEffect||shellcon.DROPEFFECT_* value
if ( !PyArg_ParseTuple(args, "OlOl:DragEnter", &obpDataObj, &grfKeyState, &obpt, &dwEffect) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDataObj, IID_IDataObject, (void **)&pDataObj, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyObject_AsPOINTL( obpt, &pt )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDT->DragEnter( pDataObj, grfKeyState, pt, &dwEffect );
if (pDataObj) pDataObj->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDT, IID_IDropTarget );
return PyInt_FromLong(dwEffect);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:34,代码来源:PyIDropTarget.cpp
示例8: GetI
// @pymethod |PyIPersistStream|Load|Initializes an object from the stream where it was previously saved.
PyObject *PyIPersistStream::Load(PyObject *self, PyObject *args)
{
IPersistStream *pMy = GetI(self);
if (pMy==NULL) return NULL;
PyObject *obStream;
// @pyparm <o PyIStream>|stream||Stream object to load from.
if (!PyArg_ParseTuple(args, "O:Load", &obStream))
return NULL;
IStream *pStream;
if (!PyCom_InterfaceFromPyInstanceOrObject(obStream, IID_IStream, (void **)&pStream, FALSE /*bNoneOK*/))
return NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pMy->Load(pStream);
pStream->Release();
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
return PyCom_BuildPyException(hr, pMy, IID_IPersistStream);
Py_INCREF(Py_None);
return Py_None;
// @comm This method loads an object from its associated stream. The seek pointer is set as it was in the most recent <om PyIPersistStream.Save> method. This method can seek and read from the stream, but cannot write to it.
// @comm On exit, the seek pointer must be in the same position it was in on entry, immediately past the end of the data.
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:26,代码来源:PyIPersistStream.cpp
示例9: GetI
// @pymethod |PyIRemoteDebugApplicationEvents|OnBreakFlagChange|Description of OnBreakFlagChange.
PyObject *PyIRemoteDebugApplicationEvents::OnBreakFlagChange(PyObject *self, PyObject *args)
{
IRemoteDebugApplicationEvents *pIRDAE = GetI(self);
if ( pIRDAE == NULL )
return NULL;
// @pyparm int|abf||Description for abf
// @pyparm <o PyIRemoteDebugApplicationThread>|prdatSteppingThread||Description for prdatSteppingThread
PyObject *obprdatSteppingThread;
APPBREAKFLAGS abf;
IRemoteDebugApplicationThread *prdatSteppingThread;
if ( !PyArg_ParseTuple(args, "iO:OnBreakFlagChange", &abf, &obprdatSteppingThread) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obprdatSteppingThread, IID_IRemoteDebugApplicationThread, (void **)&prdatSteppingThread, FALSE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pIRDAE->OnBreakFlagChange( abf, prdatSteppingThread );
prdatSteppingThread->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:27,代码来源:PyIRemoteDebugApplicationEvents.cpp
示例10: GetI
// @pymethod int|PyIDataObject|DAdvise|Connects the object to an interface that will receive notifications when its data changes
// @rdesc Returns a unique number that is used to identify the connection
PyObject *PyIDataObject::DAdvise(PyObject *self, PyObject *args)
{
IDataObject *pIDO = GetI(self);
if ( pIDO == NULL )
return NULL;
FORMATETC formatetc;
PyObject *obpformatetc;
// @pyparm <o PyFORMATETC>|pformatetc||Defines the type of data for which the sink will receive notifications.
// @pyparm int|advf||Combination of values from ADVF enum. (which currently do not appear in any of the constants modules!)
// @pyparm <o PyIAdviseSink>|pAdvSink||Currently this interface is not wrapped.
PyObject *obpAdvSink;
DWORD advf;
IAdviseSink *pAdvSink;
if ( !PyArg_ParseTuple(args, "OlO:DAdvise", &obpformatetc, &advf, &obpAdvSink) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsFORMATETC( obpformatetc, &formatetc )) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpAdvSink, IID_IAdviseSink, (void **)&pAdvSink, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
DWORD dwConnection;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDO->DAdvise( &formatetc, advf, pAdvSink, &dwConnection );
PY_INTERFACE_POSTCALL;
if (pAdvSink) pAdvSink->Release();
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDO, IID_IDataObject );
return PyInt_FromLong(dwConnection);
}
开发者ID:Logan-lu,项目名称:pywin32,代码行数:32,代码来源:PyIDataObject.cpp
示例11: GetI
// @pymethod |PyIContext|SetProperty|Sets a property on the context
PyObject *PyIContext::SetProperty(PyObject *self, PyObject *args)
{
IContext *pIC = GetI(self);
if ( pIC == NULL )
return NULL;
// @pyparm <o PyIID>|rpolicyId||GUID identifying the property to be set
// @pyparm int|flags||Reserved, use only 0
// @pyparm <o PyIUnknown>|pUnk||The property value
CPFLAGS flags;
PyObject *obrpolicyId;
PyObject *obUnk;
IID rpolicyId;
IUnknown * pUnk;
if ( !PyArg_ParseTuple(args, "OkO:SetProperty", &obrpolicyId, &flags, &obUnk) )
return NULL;
if (!PyWinObject_AsIID(obrpolicyId, &rpolicyId))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&pUnk, FALSE))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIC->SetProperty( rpolicyId, flags, pUnk );
pUnk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIC, IID_IContext );
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:32,代码来源:PyIContext.cpp
示例12: GetI
// @pymethod |PyICustomDestinationList|AppendCategory|Adds a custom category to the jump list
PyObject *PyICustomDestinationList::AppendCategory(PyObject *self, PyObject *args)
{
ICustomDestinationList *pICDL = GetI(self);
if ( pICDL == NULL )
return NULL;
TmpWCHAR Category;
PyObject *obCategory, *obItems;
IObjectArray *Items;
// @pyparm str|Category||Display name of the category, can also be a dll and resource id for localization
// @pyparm <o PyIObjectArray>|Items||Collection of IShellItem and/or IShellLink interfaces
if ( !PyArg_ParseTuple(args, "OO:AppendCategory", &obCategory, &obItems))
return NULL;
if (!PyWinObject_AsWCHAR(obCategory, &Category, FALSE))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obItems, IID_IObjectArray, (void **)&Items, FALSE))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pICDL->AppendCategory(Category, Items);
Items->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pICDL, IID_ICustomDestinationList );
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:29,代码来源:PyICustomDestinationList.cpp
示例13: PyCom_PyObjectFromIUnknown
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGShellItem::BindToHandler(
/* [unique][in] */ IBindCtx * pbc,
/* [in] */ REFGUID bhid,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void ** ppv)
{
PY_GATEWAY_METHOD;
PyObject *obpbc;
PyObject *obbhid;
PyObject *obriid;
obpbc = PyCom_PyObjectFromIUnknown(pbc, IID_IBindCtx, TRUE);
obbhid = PyWinObject_FromIID(bhid);
obriid = PyWinObject_FromIID(riid);
PyObject *result;
HRESULT hr=InvokeViaPolicy("BindToHandler", &result, "OOO", obpbc, obbhid, obriid);
Py_XDECREF(obpbc);
Py_XDECREF(obbhid);
Py_XDECREF(obriid);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppv;
if (!PyArg_Parse(result, "O" , &obppv))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppv, riid, (void **)ppv, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
Py_DECREF(result);
return hr;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:33,代码来源:PyIShellItem.cpp
示例14: GetI
// @pymethod |PyIOleObject|SetMoniker|Description of SetMoniker.
PyObject *PyIOleObject::SetMoniker(PyObject *self, PyObject *args)
{
IOleObject *pIOO = GetI(self);
if ( pIOO == NULL )
return NULL;
// @pyparm int|dwWhichMoniker||Description for dwWhichMoniker
// @pyparm <o PyIMoniker>|pmk||Description for pmk
PyObject *obpmk;
DWORD dwWhichMoniker;
IMoniker * pmk;
if ( !PyArg_ParseTuple(args, "iO:SetMoniker", &dwWhichMoniker, &obpmk) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpmk, IID_IMoniker, (void **)&pmk, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIOO->SetMoniker( dwWhichMoniker, pmk );
if (pmk) pmk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
Py_INCREF(Py_None);
return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:29,代码来源:PyIOleObject.cpp
注:本文中的PyCom_InterfaceFromPyInstanceOrObject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论