Esempio n. 1
0
// @pymethod |PyIFileOperation|SetProperties|Specifies a set of properties to be changed.
// @comm Note that these properties will be set for *any* files created by the operation, not
// just items passed to ApplyPropertiesToItem(s).  New items created as the result of a
// rename, copy, or move must have a property handler, or the operation fails with the vague
// <nl>com_error: (-2147467259, 'Unspecified error', None, None) (E_FAIL, or 0x80004005 in hex)
// even though the given file operation was actually performed.
PyObject *PyIFileOperation::SetProperties(PyObject *self, PyObject *args)
{
    IFileOperation *pIFO = GetI(self);
    if ( pIFO == NULL )
        return NULL;
    // @pyparm <o PyIPropertyChangeArray>|proparray||Sequence of property changes to be performed (see <om propsys.PSCreatePropertyChangeArray>)
    PyObject *obpproparray;
    IPropertyChangeArray * pproparray;
    if ( !PyArg_ParseTuple(args, "O:SetProperties", &obpproparray) )
        return NULL;
    if (!PyCom_InterfaceFromPyInstanceOrObject(obpproparray, IID_IPropertyChangeArray, (void **)&pproparray, FALSE))
        return NULL;
    HRESULT hr;
    PY_INTERFACE_PRECALL;
    hr = pIFO->SetProperties( pproparray );
    pproparray->Release();
    PY_INTERFACE_POSTCALL;

    if ( FAILED(hr) )
        return PyCom_BuildPyException(hr, pIFO, IID_IFileOperation );
    Py_INCREF(Py_None);
    return Py_None;
}
// @pymethod |PyITransferSource|SetProperties|Specifies changes to be applied to items' properties
PyObject *PyITransferSource::SetProperties(PyObject *self, PyObject *args)
{
	ITransferSource *pITS = GetI(self);
	if ( pITS == NULL )
		return NULL;
	// @pyparm <o PyIPropertyChangeArray>|proparray||Property changes to be applied by <om PyITransferSource.ApplyPropertiesToItem>
	PyObject *obpproparray;
	IPropertyChangeArray * pproparray;
	if ( !PyArg_ParseTuple(args, "O:SetProperties", &obpproparray) )
		return NULL;
	if (!PyCom_InterfaceFromPyObject(obpproparray, IID_IPropertyChangeArray, (void **)&pproparray, FALSE))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pITS->SetProperties( pproparray );
	pproparray->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pITS, IID_ITransferSource );
	Py_INCREF(Py_None);
	return Py_None;
}