IPersistMessage::Load

The IPersistMessage::Load method loads the form for a specified message.

Quick Info

See IPersistMessage : IUnknown.

HRESULT Load(
  LPMESSAGESITE pMessageSite,   
  LPMESSAGE pMessage,           
  ULONG ulMessageStatus,        
  ULONG ulMessageFlags          
);
 

Parameters

pMessageSite
[in] Pointer to the message site for the form to be loaded.
pMessage
[in] Pointer to the message for which the form should be loaded.
ulMessageStatus
[in] Bitmask of client-defined or provider-defined flags — copied from the message's PR_MSG_STATUS property — that provides information on the state of the message.
ulMessageFlags
[in] Bitmask of flags — copied from the message's PR_MESSAGE_FLAGS property — that provides further information on the state of the message.

Return Values

S_OK
The form was successfully loaded.

Remarks

Form viewers call the IPersistMessage::Load method to load a form for an existing message.

Notes to Implementers

Load is called only when a form is in one of the following states:

If a form viewer calls Load while the form is in any other state, the method returns E_UNEXPECTED.

If your form has a reference to an active message site other than the one that is passed into Load, release the original site because it will no longer be used. Store the pointers to the message site and message from the pMessageSite and pMessage parameters and call both objects' IUnknown::AddRef methods to increment their reference counts.

After AddRef has completed, store the properties from the ulMessageStatus and ulMessageFlags parameters into the form. Transition the form to its Normal state before displaying it and notify registered viewers by calling their IMAPIViewAdviseSink::OnNewMessage methods.

If no errors occur, return S_OK.

For more information on loading storage objects, see the documentation for the following methods in the OLE Programmer's Reference:

IPersistStorage::Load

IPersistStream::Load

IPersistFile::Load

See Also

PR_MESSAGE_FLAGS, PR_MSG_STATUS