Last modified: July 23, 2011
Applies to: Outlook
Deletes the current message.
Following the return of DeleteMessage, form objects must check for a new message and then dismiss themselves if none exists. To determine whether the message DeleteMessage acted on was deleted or moved to a Deleted Items folder, a form object can call the IMAPIMessageSite::GetSiteStatus method to determine whether the DELETE_IS_MOVE flag was returned.
If a form viewer's implementation of the DeleteMessage method moves to the next message after it deletes a message, the implementation should call the IMAPIViewContext::ActivateNext method and pass the VCDIR_DELETE flag before performing the actual deletion. If a form viewer's implementation of DeleteMessage moves the deleted message (for example, to a Deleted Items folder), the implementation must save changes to the message if the message was modified.
A typical implementation of DeleteMessage performs the following tasks:
If the implementation is moving the message, it calls the IPersistMessage::Save method, passing null in the pMessage parameter and true in the fSameAsLoad parameter.
It calls the IMAPIViewContext::ActivateNext method, passing the VCDIR_DELETE flag in the ulDir parameter.
If the ActivateNext call fails, it returns. If ActivateNext returns S_FALSE, it calls the IPersistMessage::HandsOffMessage method.
It deletes or moves the message.
To obtain the RECT structure used by a form's window, call the Windows GetWindowRect function.
For a list of interfaces related to form servers, see MAPI Form Interfaces.