IMAPIViewContext::SetAdviseSink

Applies to: Outlook 2013 | Outlook 2016

Manages a form's registration to receive notifications about changes in the viewer.

HRESULT SetAdviseSink(
LPMAPIFORMADVISESINK pmvns
);

Parameters

pmvns

[in] Pointer to a form advise sink object or NULL.

Return value

S_OK

The registration or cancellation for form notification succeeded.

Remarks

Form objects call the IMAPIViewContext::SetAdviseSink method to either register to learn about changes in the form viewer or cancel a prior registration. When pmvns is set to NULL, the form wants to cancel a registration. When pmvns points to a valid form advise sink, the form wants to register for future notifications.

Notes to implementers

When SetAdviseSink includes a form advise sink pointer, keep a reference to it until another SetAdviseSink call is made to cancel notification. Send a notification when a change occurs in your viewer and when you are loading a new message.

For more information, see Sending and Receiving Form Notifications.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MyMAPIFormViewer.cpp
CMyMAPIFormViewer::SetAdviseSink
MFCMAPI implements the IMAPIViewContext::SetAdviseSink method in this function.

See also

MFCMAPI as a Code Sample