IMAPIMessageSite::DeleteMessage

The IMAPIMessageSite::DeleteMessage method deletes the current message.

Quick Info

See IMAPIMessageSite : IUnknown1XJJ0FL.

 

HRESULT DeleteMessage(

    LPMAPIVIEWCONTEXT pViewContext,

 

    LPCRECT prcPosRect

 

   )

 

 

Parameters

pViewContext

[in] Pointer to a view context object.

prcPosRect

[in] Pointer to a RECT structure containing the current form s window size and position. The next form displayed also uses this window rectangle.

 

Return Values

S_OK

The call succeeded and has returned the expected value or values.

MAPI_E_NO_SUPPORT

The operation is not supported by this message site.

 

Remarks

A form object calls the IMAPIMessageSite::DeleteMessage method to delete the message the form is currently attached to.

Notes to Callers

Following the return of DeleteMessage, form objects must check for a new message and then dismiss themselves if none exists. To determine whether a message DeleteMessage acted on is deleted or moved to a Deleted Items folder, a form object can call the IMAPIMessageSite::GetSiteStatus1JXF_VS method and check if the DELETE_IS_MOVE flag was returned.

Notes to Implementers

If a form viewer s implementation of DeleteMessage moves to the next message after deleting a message, it should call the IMAPIViewContext::ActivateNextSLASEP method passing the VCDIR_DELETE flag prior to performing the actual deletion. If a form viewer s implementation of DeleteMessage moves the deleted message, for example to a Deleted Items folder, it must save changes to the message if the message has been modified.

A typical implementation of DeleteMessage:

  1.  If moving the message, calls the IPersistMessage::SaveHHDHE. method passing NULL for its pMessage parameter and TRUE for its fSameAsLoad parameter.

  2.  Calls the IMAPIViewContext::ActivateNext method passing the VCDIR_DELETE flag in its ulDir parameter.

  3.  If the ActivateNext call failed, it returns. If ActivateNext returned S_FALSE, it calls the IPersistMessage::HandsOffMessage_ZPA. method.

  4.  Deletes or moves the message.

 

To obtain the RECT structure used by a form s window, call the Windows GetWindowRect function.

For more information about implementing the interfaces related to form servers, see MAPI Form Interfaces Used by Client Applications1AR39HN.

See Also

IMAPIMessageSite::GetSiteStatus, IMAPIViewContext::ActivateNext, IPersistMessage::HandsOffMessage, IPersistMessage::Save