Esempio n. 1
0
// @pymethod (int, <o PyIUnknown>)|PyIContext|GetProperty|Retrieves a context property
// @rdesc Returns flags (CPFLAGS is reserved, no defined values) and the IUnknown interface set for the property 
PyObject *PyIContext::GetProperty(PyObject *self, PyObject *args)
{
	IContext *pIC = GetI(self);
	if ( pIC == NULL )
		return NULL;
	// @pyparm <o PyIID>|rGuid||GUID that identifies a context property
	CPFLAGS flags;
	PyObject *obGuid;
	IID rGuid;
	IUnknown * pUnk;
	if ( !PyArg_ParseTuple(args, "O:GetProperty", &obGuid))
		return NULL;
	if (!PyWinObject_AsIID(obGuid, &rGuid))
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIC->GetProperty( rGuid, &flags, &pUnk );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIC, IID_IContext );
	return Py_BuildValue("kN", flags, PyCom_PyObjectFromIUnknown(pUnk, IID_IUnknown, FALSE));
}