Platform SDK: MAPI |
The IPersistMessage::SaveCompleted method notifies the form that a save operation has been completed.
See IPersistMessage : IUnknown.
HRESULT SaveCompleted( LPMESSAGE pMessage );
The IPersistMessage::SaveCompleted method is called by a form viewer to notify the form that all pending changes have been saved. SaveCompleted should only be called when the form is in one of the following states:
There are several possible actions that the SaveCompleted method can perform, depending on what the message pointer parameter contains, and what state the message is in. However, when an action is successful, always save the current state of the message pointed to by the pMessage parameter and transition the form to its Normal state.
The following table describes the variables that affect the actions you should take in your implementation of SaveCompleted:
Condition | Action |
---|---|
The pMessage parameter is NULL and the fSameAsLoad parameter to Save was set to TRUE. | Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The pMessage parameter is NULL and the fSameAsLoad parameter to Save was set to FALSE. | Return S_OK. |
The form is in the Hands Off From Normal state. | Release the current message and replace it with the message pointed to by pMessage. Call the replacement message's IUnknown::AddRef method and return S_OK. |
The form is in the Hands Off After Save state. | Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The form is in the No Scribble state. | Release the current message and replace it with the message pointed to by pMessage. Call the replacement message's IUnknown::AddRef method. Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The form is in one of the Hands Off states and the pMessage parameter is set to NULL. | Return E_INVALIDARG. |
The form is in a state other than one of the Hands Off states or the No Scribble state. | Return E_UNEXPECTED. |
For more information on saving storage objects, see the documentation for one of the following methods in the OLE Programmer's Reference:
IPersistFile::SaveCompleted
IPersistStorage::SaveCompleted