Microsoft KB Archive/230770

= SAMPLE: FrmVwr.exe Extended MAPI Form Viewer =

Article ID: 230770

Article Last Modified on 8/25/2005

-

APPLIES TO


 * Microsoft Messaging Application Programming Interface

-



This article was previously published under Q230770



SUMMARY
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:

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.

Setup
Follow these steps to build the sample:  Extract the files from the self-extracting executable file FormVwr.exe. Open a command prompt in the folder where you extracted the files.  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.

Additional query words: kbfile kbsample kbEDK kbMAPI kbMFC kbMsg kbVC600 kbGrpMsg IMAPIMessageSite IMAPIViewContext IMAPIFormAdviseSink

Keywords: kbhowto kbdownload kbmsg kbfile kbsample kbfaq KB230770

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.