Share via


IMAPIForm::GetViewContext

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Returns the current view context for the form.

HRESULT GetViewContext(
  LPMAPIVIEWCONTEXT FAR * ppViewContext
);

Parameters

  • ppViewContext
    [out] A pointer to a pointer to the form's view context.

Return Value

  • S_OK
    The form's current view context was successfully returned.

  • S_FALSE
    There is no view context for the form.

Remarks

Form viewers call GetViewContext to obtain a pointer to the view context established in a previous call to IMAPIForm::SetViewContext. If no prior call has been made to SetViewContext, GetViewContext sets ppViewContext to NULL.

Notes to Implementers

Copy your form's view context pointer into the pointer passed in by the calling form viewer in the ppViewContext parameter. If the form does not have a view context, set ppViewContext to NULL.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MAPIFormFunctions.cpp

OpenMessageNonModal

MFCMAPI uses the IMAPIForm::GetViewContext method to check whether a form has a view context.

See Also

Reference

IMAPIViewContext : IUnknown

IMAPIForm : IUnknown

Concepts

MFCMAPI as a Code Sample