共用方式為


IMAPIForm::Advise

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Registers a form viewer for notifications about events that affect the form.

HRESULT Advise(
  LPMAPIVIEWADVISESINK pAdvise,
  ULONG FAR * pulConnection
);

Parameters

  • pAdvise
    [in] A pointer to a view advise sink object to receive the subsequent notifications.

  • pulConnection
    [out] A pointer to a nonzero value that represents a successful notification registration.

Return Value

  • S_OK
    The registration was successful.

  • E_OUTOFMEMORY
    The registration was unsuccessful because of insufficient memory.

Remarks

Form viewers call a form's IMAPIForm::Advise method to register for notification when changes occur to the form.

Notes to Implementers

Keep a copy of the view advise sink pointer passed in the pAdvise parameter so that you can use it to call the appropriate IMAPIViewAdviseSink method when an event occurs. Call the view advise sink's IUnknown::AddRef method to retain the pointer until notification registration is canceled. Set the contents of the pulConnection parameter to a nonzero number.

Many forms implement a helper object to handle the registration and subsequent notification of events.

For more information about the notification process in general, see Event Notification in MAPI.

For more information about notification and forms, see Sending and Receiving Form Notifications.

See Also

Reference

IMAPIForm::Unadvise

IMAPIViewAdviseSink : IUnknown

IMAPIForm : IUnknown

Concepts

Event Notification in MAPI

Sending and Receiving Form Notifications