IDataObject.DAdvise Method (FORMATETC, ADVF, IAdviseSink, Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a connection between a data object and an advisory sink. This method is called by an object that supports an advisory sink and enables the advisory sink to be notified of changes in the object's data.

Namespace:   System.Runtime.InteropServices.ComTypes
Assembly:  System (in System.dll)

int DAdvise(
	[InAttribute] ref FORMATETC pFormatetc,
	ADVF advf,
	IAdviseSink adviseSink,
	out int connection
)

Parameters

pFormatetc
Type: System.Runtime.InteropServices.ComTypes.FORMATETC

A FORMATETC structure, passed by reference, that defines the format, target device, aspect, and medium that will be used for future notifications.

advf
Type: System.Runtime.InteropServices.ComTypes.ADVF

One of the ADVF values that specifies a group of flags for controlling the advisory connection.

adviseSink
Type: System.Runtime.InteropServices.ComTypes.IAdviseSink

A pointer to the IAdviseSink interface on the advisory sink that will receive the change notification.

connection
Type: System.Int32

When this method returns, contains a pointer to a DWORD token that identifies this connection. You can use this token later to delete the advisory connection by passing it to DUnadvise. If this value is zero, the connection was not established. This parameter is passed uninitialized.

Return Value

Type: System.Int32

This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following:

Value

Description

S_OK

The advisory connection was created.

E_NOTIMPL

This method is not implemented on the data object.

DV_E_LINDEX

There is an invalid value for lindex; currently, only -1 is supported.

DV_E_FORMATETC

There is an invalid value for the pFormatetc parameter.

OLE_E_ADVISENOTSUPPORTED

The data object does not support change notification.

For more information about IDataObject::DAdvise, see the MSDN Library.

.NET Framework
Available since 2.0
Return to top
Show: