Example #1
0
// @pymethod <o PyIEnumSTATDATA>|PyIDataObject|EnumDAdvise|Creates an enumerator to list connected notification sinks.
PyObject *PyIDataObject::EnumDAdvise(PyObject *self, PyObject *args)
{
	IDataObject *pIDO = GetI(self);
	if ( pIDO == NULL )
		return NULL;
	IEnumSTATDATA *ppenumAdvise;
	if ( !PyArg_ParseTuple(args, ":EnumDAdvise") )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDO->EnumDAdvise( &ppenumAdvise );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIDO, IID_IDataObject );
	return PyCom_PyObjectFromIUnknown(ppenumAdvise, IID_IEnumSTATDATA, FALSE);
}
TEST(iDataObjectTest,Simple)
{
	IDataObject *pDataObject = NULL;
	CreateDataObject(NULL,NULL,&pDataObject,0);

	FORMATETC ftc;
	ftc.cfFormat	= CF_TEXT;
	ftc.dwAspect	= DVASPECT_CONTENT;
	ftc.lindex		= -1;
	ftc.ptd			= NULL;
	ftc.tymed		= TYMED_HGLOBAL;
	EXPECT_EQ(DV_E_FORMATETC,pDataObject->QueryGetData(&ftc));

	EXPECT_EQ(E_NOTIMPL,pDataObject->DAdvise(NULL,ADVF_NODATA,NULL,NULL));
	EXPECT_EQ(OLE_E_ADVISENOTSUPPORTED,pDataObject->DUnadvise(0));
	EXPECT_EQ(OLE_E_ADVISENOTSUPPORTED,pDataObject->EnumDAdvise(NULL));
}