Example #1
0
// @pymethod |PyIFilter|GetValue|Description of GetValue.
PyObject *PyIFilter::GetValue(PyObject *self, PyObject *args)
{
	IFilter *pIF = GetI(self);
	if ( pIF == NULL )
		return NULL;

	if ( !PyArg_ParseTuple(args, ":GetValue") )
		return NULL;
	
	HRESULT hr;
	PROPVARIANT * pPropValue = 0;
	PY_INTERFACE_PRECALL;
	hr = pIF->GetValue(&pPropValue );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) ){
		return PyCom_BuildPyException(hr, pIF, IID_IFilter );
	}


	if (pPropValue){
		PyObject *obRet = PyObject_FromPROPVARIANT(pPropValue);
		PropVariantClear(pPropValue);
		CoTaskMemFree(pPropValue);
		return obRet;
	}
	
	Py_INCREF(Py_None);
	return Py_None;
}
Example #2
0
PyObject *PyObject_FromPROPVARIANTs( PROPVARIANT *pVars, ULONG cVars )
{
	PyObject *ret = PyTuple_New(cVars);
	if (ret==NULL)
		return NULL;
	for (ULONG i=0;i<cVars;i++) {
		PyObject *sub = PyObject_FromPROPVARIANT(pVars+i);
		if (sub==NULL) {
			Py_DECREF(ret);
			return NULL;
		}
		PyTuple_SET_ITEM(ret, i, sub);
	}
	return ret;
}