![]() |
|
||||
Installing a MAPI FormA form is installed into a container by first opening this container and then using its InstallForm method. Before you can open a MAPI form container, you need to have MAPI form manager. In fact, the container is opened through IMAPIFormMgr::OpenFormContainer method. To install the form you need to specify the name and location of a configuration file (with .CFG extension) that describes your form. You may read about the format of configuration files in the "File Format of Form Configuration Files" section in MSDN Library. Well, here is the code (Forms/InstallForm): #include <afxwin.h>
int main()
HRESULT hr;
// Initialize MAPI
// Obtain MAPI session
// Open MAPI Form manager
// Open the "Personal Forms Library" container
// Install the form
As you can see, the algorithm is straightforward. You need to make sure that wCheck.Ico, wCheck.Ico and wCheck32.Exe files are located in the same place where the ChkrForm.Cfg file is. Otherwise the installation will fail. You may get all these files from the INSTFORM sample in your build environment samples under dmbsg\Exchange. Install this form and you can play a game of checkers with a remote opponent! The CHECKERS.FRM sample as delivered from Microsoft does not support Windows NT 4.0 on Intel platform. This means that trying to compile CHECKERS.FRM (results in WCHECK.EXE) and installing it on such system will likely to succeed. However, displaying a form will fail because the platform is not supported. Perhaps you can modify the sample and make it working on Intel based NT. Also, you may notice that the configuration files in Mapi\CHECKERS.FRM and Exchange\INSTFORM are different. If you wanted to install a form in a different container, say in Outbox,
this is also possible. The code is a little bit bigger because of extra
overhead in obtaining a pointer to an opened Outbox. But the strategy remains
the same: opening a MAPI form container and then installing a form in it.
I am providing the Forms/InstallFormInOutbox sample, which demonstrates
how to install a form in your Outbox.
|