SAMPLE: FrmVwr.exe Extended MAPI Form Viewer

Article translations Article translations
Article ID: 230770 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


FrmVwr.exe includes a sample that demonstrates how to implement the IMAPIMessageSite, IMAPIViewContext, and IMAPIViewAdviseSink interfaces, that make up a FormViewer object. The sample was written with Microsoft Visual C++ and Microsoft Foundation Classes (MFC).

More information

The following files are available for download from the Microsoft Download Center:
Collapse this imageExpand this image
Download FrmVwr.exe now
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

A common task in Extended MAPI is the displaying of forms. The IMAPISession object has two functions: PrepareForm and ShowForm, which are commonly used in conjunction to display a form. However, when a form is displayed in this manner it is modal to the application. In order to display a form that is non-modal, a Form Viewer must be implemented.

A MAPI Form Viewer is an object that consists of three interfaces: IMAPIMessageSite, IMAPIViewContext, and IMAPIViewAdviseSink. When these three interfaces are implemented, a form may appear with a call to IMAPIFormManager->LoadForm followed by a call to IMAPIForm->DoVerb. The Form Viewer, whose interfaces are passed as parameters to LoadForm, handles the details of showing the form and activating the Previous and Next buttons implemented in most built-in MAPI forms.


Follow these steps to build the sample:
  1. Extract the files from the self-extracting executable file FormVwr.exe.
  2. Open a command prompt in the folder where you extracted the files.
  3. Create the sample by typing the following command:
    nmake FormViewer.mak
    This action creates a .\Debug directory and places the built executable into the directory.

Running the Sample

When the program starts, you are prompted to select a profile. After you've done this, the program opens the profile's inbox and displays a list of all the messages.

Double-clicking the From field of a message displays the form using the Form Viewer object. This form is in a non-modal window and the Previous and Next buttons are active.

To compare using a Form Viewer to using a Prepare Form/Show Form, select a message and click Open Modal from the Actions menu. Note that the application is blocked until this window is closed.

This sample also demonstrates how to implement IMAPIAdviseSink to maintain a current listing of messages in the Inbox.


Article ID: 230770 - Last Review: January 10, 2015 - Revision: 3.0
Applies to
  • Microsoft Office Outlook 2007
  • Microsoft Messaging Application Programming Interface
kbnosurvey kbarchive kbdownload kbfaq kbfile kbhowto kbmsg kbsample KB230770

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from