SAMPLE: FrmVwr.exe Extended MAPI Form Viewer

ID: Q230770


The information in this article applies to:


SUMMARY

FrmVwr.exe includes a sample that demonstrates how to implement the IMAPIMessageSite, IMAPIViewContext, and IMAPIViewAdviseSink interfaces, which make up a FormViewer object.

The sample was written with Microsoft Visual C++ and Microsoft Foundation Classes (MFC).


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

FormVwr.exe
Release Date: Mar-11-1999

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
FileName Size
ColumnTags.h 269
FolderDlg.cpp 12,352
FolderDlg.h 2,505
FormViewer.cpp 3,992
FormViewer.dep 933
FormViewer.dsp 4,925
FormViewer.dsw 545
FormViewer.h 1,338
FormViewer.ico 1,078
FormViewer.mak 5,562
FormViewer.rc 4,980
FormViewer.rc2 402
Global.cpp 1,964
Global.h 720
MAPIAdviseSink.cpp 7,122
MAPIAdviseSink.h 1,366
MessageListCtrl.cpp 12,762
MessageListCtrl.h 2,554
MyMAPIFormViewer.cpp 15,049
MyMAPIFormViewer.h 3,544
resource.h 919
StdAfx.cpp 212
StdAfx.h 1,122

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, will handle 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:
  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. To create the sample type the following command:
    
    nmake FormViewer.mak 
    This creates a .\Debug directory and places the built executable into the directory.


Running the Sample

When the program starts, you will be prompted to select a profile. After you've done this, the program will open the profile's inbox and display a list of all the messages.

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

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

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


Keywords          : kbfile kbsample kbEDK kbMAPI kbMFC kbMsg kbVC600 kbGrpMsg kbDSupport 
Version           : WINDOWS:1.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: June 9, 1999