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


C++ PyCom_BuildPyException函数代码示例

本文整理汇总了C++中PyCom_BuildPyException函数的典型用法代码示例。如果您正苦于以下问题:C++ PyCom_BuildPyException函数的具体用法?C++ PyCom_BuildPyException怎么用?C++ PyCom_BuildPyException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: GetI

// @pymethod |PyIDocHostUIHandler|EnableModeless|Description of EnableModeless.
PyObject *PyIDocHostUIHandler::EnableModeless(PyObject *self, PyObject *args)
{
	IDocHostUIHandler *pIDHUIH = GetI(self);
	if ( pIDHUIH == NULL )
		return NULL;
	// @pyparm int|fEnable||Description for fEnable
	BOOL fEnable;
	if ( !PyArg_ParseTuple(args, "i:EnableModeless", &fEnable) )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDHUIH->EnableModeless( fEnable );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
	return PyInt_FromLong(hr);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:18,代码来源:PyIDocHostUIHandler.cpp

示例2: GetI

// @pymethod int|PyIPropertyDescriptionList|GetCount|Gets the number of properties in the list
PyObject *PyIPropertyDescriptionList::GetCount(PyObject *self, PyObject *args)
{
	IPropertyDescriptionList *pIPDL = GetI(self);
	if ( pIPDL == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":GetCount"))
		return NULL;
	UINT cnt;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIPDL->GetCount(&cnt);
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPDL, IID_IPropertyDescriptionList );
	return PyLong_FromUnsignedLong(cnt);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyIPropertyDescriptionList.cpp

示例3: GetI

// @pymethod <o PyIEnumResources>|PyIShellItemResources|EnumResources|Description of EnumResources.
PyObject *PyIShellItemResources::EnumResources(PyObject *self, PyObject *args)
{
	IShellItemResources *pISIR = GetI(self);
	if ( pISIR == NULL )
		return NULL;
	IEnumResources *penumr;
	if ( !PyArg_ParseTuple(args, ":EnumResources"))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISIR->EnumResources(&penumr);
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISIR, IID_IShellItemResources);
	return PyCom_PyObjectFromIUnknown(penumr, IID_IEnumResources, FALSE);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyIShellItemResources.cpp

示例4: GetI

// @pymethod |PyIBackgroundCopyJob|Complete|Description of Complete.
PyObject *PyIBackgroundCopyJob::Complete(PyObject *self, PyObject *args)
{
	IBackgroundCopyJob *pIBCJ = GetI(self);
	if ( pIBCJ == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":Complete") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIBCJ->Complete( );

	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob );
	return PyInt_FromLong(hr);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyIBackgroundCopyJob.cpp

示例5: CHECK_NO_ARGS2

// A DAO hack!
// @pymethod <o PyIDispatch>|win32uiole|DaoGetEngine|
static PyObject *DaoGetEngine(PyObject *self, PyObject *args)
{
	CHECK_NO_ARGS2(args, "DaoGetEngine");

#	ifdef _M_X64
	return NULL;
#	else
	AfxDaoInit();
	DAODBEngine* pEngine = AfxDaoGetEngine();
	IDispatch *pDisp;
	HRESULT hr = pEngine->QueryInterface(IID_IDispatch, (void **)&pDisp);
	if (FAILED(hr))
		return PyCom_BuildPyException(hr);
	pEngine->Release();
	return PyCom_PyObjectFromIUnknown(pDisp, IID_IDispatch, FALSE);
#endif
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:19,代码来源:win32uiole.cpp

示例6: GetI

// @pymethod |PyINameSpaceTreeControl|GetRootItems|Description of GetRootItems.
PyObject *PyINameSpaceTreeControl::GetRootItems(PyObject *self, PyObject *args)
{
	INameSpaceTreeControl *pINSTC = GetI(self);
	if ( pINSTC == NULL )
		return NULL;
	IShellItemArray * ppsiaRootItems;
	if ( !PyArg_ParseTuple(args, ":GetRootItems") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pINSTC->GetRootItems( &ppsiaRootItems );

	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pINSTC, IID_INameSpaceTreeControl );
	return PyCom_PyObjectFromIUnknown(ppsiaRootItems, IID_IShellItemArray, FALSE);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:18,代码来源:PyINameSpaceTreeControl.cpp

示例7: GetI

// @pymethod str|PyIShellLibrary|GetIcon|Returns the location of the library's icon
// @rdesc Uses "module,resource" format
PyObject *PyIShellLibrary::GetIcon(PyObject *self, PyObject *args)
{
	IShellLibrary *pISL = GetI(self);
	if ( pISL == NULL )
		return NULL;
	LPWSTR Icon;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISL->GetIcon(&Icon);
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISL, IID_IShellLibrary );
	PyObject *ret = PyWinObject_FromWCHAR(Icon);
	CoTaskMemFree(Icon);	// Docs don't specify, but this doesn't leak
	return ret;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:19,代码来源:PyIShellLibrary.cpp

示例8: ReadClassStm

// @pymethod <o PyIID>|pythoncom|ReadClassStm|Retrieves the CLSID from a stream
PyObject *pythoncom_ReadClassStm(PyObject *self, PyObject *args)
{
	PyObject *obStm;
	if (!PyArg_ParseTuple(args, "O:ReadClassStm",
		&obStm))	// @pyparm <o PyIStream>|Stm||An IStream interface
		return NULL;
	IStream *pStm;
	if (!PyCom_InterfaceFromPyObject(obStm, IID_IStream, (void **)&pStm, FALSE))
		return NULL;
	CLSID clsidRet;
	PY_INTERFACE_PRECALL;
	HRESULT hr = ReadClassStm(pStm, &clsidRet);
	pStm->Release();
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr)) return PyCom_BuildPyException(hr);
	return PyWinObject_FromIID(clsidRet);
}
开发者ID:locsic,项目名称:Law-Enforcement-Scripts,代码行数:18,代码来源:PyStorage.cpp

示例9: GetI

// @pymethod tuple|PyIPropertyStorage|Stat|Returns various infomation about the property set
// @rdesc Returns a tuple representing a STATPROPSETSTG struct.
PyObject *PyIPropertyStorage::Stat(PyObject *self, PyObject *args)
{
	IPropertyStorage *pIPS = GetI(self);
	if ( pIPS == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":Stat") )
		return NULL;
	STATPROPSETSTG p;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIPS->Stat( &p );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
	return PyCom_PyObjectFromSTATPROPSETSTG(&p);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:19,代码来源:PyIPropertyStorage.cpp

示例10: GetI

// @pymethod |PyIServerSecurity|RevertToSelf|Ends impersonation of client
PyObject *PyIServerSecurity::RevertToSelf(PyObject *self, PyObject *args)
{
	IServerSecurity *pISS = GetI(self);
	if ( pISS == NULL )
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISS->RevertToSelf( );

	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISS, IID_IServerSecurity );
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:18,代码来源:PyIServerSecurity.cpp

示例11: ReadClassStg

// @pymethod <o PyIID>|pythoncom|ReadClassStg|Reads a CLSID from a storage object.
PyObject *pythoncom_ReadClassStg(PyObject *self, PyObject *args)
{
	PyObject *obStg;
	if (!PyArg_ParseTuple(args, "O:ReadClassStg",
					   &obStg)) // @pyparm <o PyIStorage>|storage||The storage to read the CLSID from.
		return NULL;
	IStorage *pStorage;
	if (!PyCom_InterfaceFromPyObject(obStg, IID_IStorage, (void **)&pStorage, FALSE))
		return NULL;
	CLSID clsidRet;
	PY_INTERFACE_PRECALL;
	HRESULT hr = ReadClassStg(pStorage, &clsidRet);
	pStorage->Release();
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr)) return PyCom_BuildPyException(hr);
	return PyWinObject_FromIID(clsidRet);
}
开发者ID:locsic,项目名称:Law-Enforcement-Scripts,代码行数:18,代码来源:PyStorage.cpp

示例12: GetI

// @pymethod |PyIBackgroundCopyJob2|GetReplyProgress|Description of GetReplyProgress.
PyObject *PyIBackgroundCopyJob2::GetReplyProgress(PyObject *self, PyObject *args)
{
	IBackgroundCopyJob2 *pIBCJ2 = GetI(self);
	if ( pIBCJ2 == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":GetReplyProgress") )
		return NULL;
	HRESULT hr;
	BG_JOB_REPLY_PROGRESS progress;
	PY_INTERFACE_PRECALL;
	hr = pIBCJ2->GetReplyProgress( &progress );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIBCJ2, IID_IBackgroundCopyJob2 );
	return PyObject_FromBG_JOB_REPLY_PROGRESS(&progress);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:18,代码来源:PyIBackgroundCopyJob2.cpp

示例13: GetI

// @pymethod |PyICategoryProvider|GetDefaultCategory|Description of GetDefaultCategory.
PyObject *PyICategoryProvider::GetDefaultCategory(PyObject *self, PyObject *args)
{
	ICategoryProvider *pICP = GetI(self);
	if ( pICP == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":GetDefaultCategory") )
		return NULL;
	HRESULT hr;
	GUID guid = __uuidof(NULL);
	SHCOLUMNID scid;
	PY_INTERFACE_PRECALL;
	hr = pICP->GetDefaultCategory( &guid, &scid );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pICP, IID_ICategoryProvider );
	return Py_BuildValue("NN", PyWinObject_FromIID(guid), PyObject_FromSHCOLUMNID(&scid));
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:18,代码来源:PyICategoryProvider.cpp

示例14: GetI

// @pymethod <o PyIUnknown>|PyIMoniker|BindToObject|Uses the moniker to bind to the object it identifies.
PyObject *PyIMoniker::BindToObject(PyObject *self, PyObject *args)
{
	// @pyparm <o PyIBindCtx>|bindCtx||bind context object to be used.
	// @pyparm <o PyIMoniker>|moniker||If the moniker is part of a composite moniker, otherwise None
	// @pyparm <o IID>|iidResult||IID of the result object.
	PyObject *obBindCtx;
	PyObject *obMoniker;
	PyObject *obIID;

	if (!PyArg_ParseTuple(args, "OOO:BindToObject", &obBindCtx, &obMoniker, &obIID))
		return NULL;

	IMoniker *pMy = GetI(self);
	if (pMy==NULL) return NULL;

	IBindCtx *pBindCtx;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obBindCtx, IID_IBindCtx, (void **)&pBindCtx, FALSE))
		return NULL;
	
	IMoniker *pMonLeft = NULL;
	if (obMoniker!=Py_None) {
		if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) {
			PYCOM_RELEASE(pBindCtx);
			return NULL;
		}
	}
	IID iid;
	if (!PyWinObject_AsIID(obIID, &iid)) {
		PY_INTERFACE_PRECALL;
		pBindCtx->Release();
		if (pMonLeft) pMonLeft->Release();
		PY_INTERFACE_POSTCALL;
		return NULL;
	}

	void *pResult = NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pMy->BindToObject(pBindCtx, pMonLeft, iid, &pResult );
	pBindCtx->Release();
	if (pMonLeft) pMonLeft->Release();
	PY_INTERFACE_POSTCALL;

	if (S_OK!=hr) // S_OK only acceptable
		return PyCom_BuildPyException(hr, pMy, IID_IMoniker);
	return PyCom_PyObjectFromIUnknown((IUnknown *)pResult, iid, FALSE );
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:47,代码来源:PyIMoniker.cpp

示例15: GetI

// @pymethod |PyIStorage|SetElementTimes|Sets the modification, access, and creation times of the specified storage element, if supported by the underlying file system.
PyObject *PyIStorage::SetElementTimes(PyObject *self, PyObject *args)
{
	IStorage *pIS = GetI(self);
	if ( pIS == NULL )
		return NULL;
	// @pyparm string|name||The name of the storage object element whose times are to be modified. If NULL, the time is set on the root storage rather than one of its elements. 
	// @pyparm <o PyTime>|ctime||Either the new creation time for the element or None if the creation time is not to be modified.
	// @pyparm <o PyTime>|atime||Either the new access time for the element or None if the access time is not to be modified.
	// @pyparm <o PyTime>|mtime||Either the new modification time for the element or None if the modification time is not to be modified.
	PyObject *obName;
	PyObject *obpctime;
	PyObject *obpatime;
	PyObject *obpmtime;
	if ( !PyArg_ParseTuple(args, "OOOO:SetElementTimes", &obName, &obpctime, &obpatime, &obpmtime) )
		return NULL;
	FILETIME *pctime=NULL, ctime;
	FILETIME *patime=NULL, atime;
	FILETIME *pmtime=NULL, mtime;
	if (obpctime!=Py_None) {
		if (!PyWinObject_AsFILETIME(obpctime, &ctime))
			return NULL;
		pctime = &ctime;
	}
	if (obpatime != Py_None) {
		if (!PyWinObject_AsFILETIME(obpatime, &atime))
			return NULL;
		patime = &atime;
	}
	if (obpmtime != Py_None) {
		if (!PyWinObject_AsFILETIME(obpmtime, &mtime))
			return NULL;
		pmtime = &mtime;
	}
	BSTR bstrName;
	if (!PyWinObject_AsBstr(obName, &bstrName))
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIS->SetElementTimes( bstrName, pctime, patime, pmtime );
	PyWinObject_FreeBstr(bstrName);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIS, IID_IStorage);
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:locsic,项目名称:Law-Enforcement-Scripts,代码行数:46,代码来源:PyIStorage.cpp


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