| |
| BOOL WINAPI MimeReplaceStoredMessage( |
| |
HMESSAGESTORE hStorage, |
|
| |
LONG nMessageId, |
|
| |
HMESSAGE hMessage, |
|
| |
DWORD dwReserved |
|
| ); |
The MimeReplaceStoredMessage function replaces the
specified message in a message store.
Parameters
- hStorage
- Handle to the message store.
- nMessageId
- An integer value which specifies the message number that should
be replaced.
- hMessage
- Handle to the message that will be stored.
- dwReserved
- A reserved parameter. This value must always be zero.
Return Value
If the function succeeds, the return value is non-zero. If the
function fails, the return value is zero. To get extended error
information, call MimeGetLastError.
Remarks
The MimeReplaceStoredMessage function replaces the
specified message with a new message. The message number may be a
message that has been previously marked for deletion. It is important
to note that the change will not be reflected in the physical storage
file until it has been closed. If the application needs to replace
messages in the message store, it is recommended that the file be
opened for exclusive access using the MIME_STORAGE_LOCK option.
Example
HMESSAGE hMessage;
// Compose a new message
hMessage = MimeComposeMessage(lpszSender,
lpszRecipient,
NULL,
lpszSubject,
lpszMessage,
NULL,
MIME_CHARSET_DEFAULT,
MIME_ENCODING_DEFAULT);
if (hMessage != INVALID_MESSAGE)
{
HMESSAGESTORE hStorage;
LONG nLastMessage;
BOOL bResult;
// Open the message storage file
hStorage = MimeOpenMessageStore(lpszFileName, MIME_STORAGE_WRITE);
if (hStorage == INVALID_MESSAGESTORE)
{
// Close the message and return if we are unable to
// open the storage file
MimeCloseMessage(hMessage);
return;
}
if (MimeGetStoredMessageCount(hStorage, &nLastMessage) < 1)
{
// No messages are stored in the file
MimeCloseMessageStore(hStorage);
MimeCloseMessage(hMessage);
return;
}
// Replace the last message in the message store
bResult = MimeReplaceStoredMessage(hStorage, nLastMessage, hMessage, 0);
if (bResult == FALSE)
{
// We were unable to replace the message
}
// Close the message store
MimeCloseMessageStore(hStorage);
// Close the message that was created
MimeCloseMessage(hMessage);
}
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csmsgv12.lib
See Also
|
|