Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IMAPISession::PrepareForm

Creates a numeric token that the IMAPISession::ShowForm method uses to access a message.

HRESULT PrepareForm(
  LPCIID lpInterface,
  LPMESSAGE lpMessage,
  ULONG FAR * lpulMessageToken
);

Parameters

lpInterface

[in] A pointer to the interface identifier (IID) that represents the interface to be used to access the message. Passing NULL results in the standard interface, or IMessage, being used. The lpInterface parameter must be NULL or IID_IMessage.

lpMessage

[in] A pointer to the message to be displayed in the form.

lpulMessageToken

[out] A pointer to a message token, which is used by the IMAPISession::ShowForm method to access the message pointed to by lpMessage.

S_OK

The form preparation was successful.

The IMAPISession::PrepareForm method creates a message token for the message pointed to by the lpMessage parameter and calls the message's IUnknown::AddRef method. This token is passed in the ulMessageToken parameter to IMAPISession::ShowForm.

If the call to PrepareForm succeeds, release the message pointed to by lpMessage by calling its IUnknown::Release method before you call ShowForm. Failure to release the message before you call ShowForm can cause memory leaks.

For MFCMAPI sample code, see the following table.

FileFunctionComment

MAPIFormFunctions.cpp

OpenMessageModal

MFCMAPI uses the IMAPISession::PrepareForm method, along with IMAPISession::ShowForm, to display a message in a modal form.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.