Composing a New Message Using a Form

To use a form to compose a new message, first create a new custom message object.

    To compose a new message using a form
  1. Call the form manager's IMAPIFormMgr::ResolveMessageClass method to retrieve a pointer to a form information object — an object that implements the IMAPIFormInfo interface.
  2. Pass the pointer to the form information object in a call to IMAPIFormMgr::CreateForm. CreateForm loads the appropriate form server. In addition, pass an interface identifier to CreateForm to specify the interface to be used to access the new message. Typically, you request IPersistMessage by passing IID_IPersistMessage to CreateForm.
  3. Save the new message by calling its IPersistMessage::Save method. The form server should set values for the message's required properties when it creates the message.
  4. Load the message by using one of two strategies: IMAPIFormMgr::LoadForm or IMAPISession::PrepareForm followed by IMAPISession::ShowForm. For more information about these strategies, see Loading a Message Into a Form.

Note There are opportunities for performance gains when loading a new custom message into a form server because you will already have had an opportunity to get some information about the message — such as its message class — during the processing required for the ResolveMessageClass and CreateForm calls. Because of this, you will be able to simplify the processing required before calling LoadForm over that described in the topic Loading a Message into a Form .