共用方式為


MSMQMessage.IsLastInTransaction

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Introduced in MSMQ 2.0.) The IsLastInTransaction property of the MSMQMessage object indicates whether the message was the last message sent in its transaction.

This property is superseded by MSMQMessage.IsLastInTransaction2 in MSMQ 3.0.

Data type: Short
Run-time access: Read-only
Property IsLastInTransaction As Short  

Property Value

A Short set to one of the following values:

1

The message was the last message sent in the transaction.

0

The message was not the last message sent in the transaction.

Remarks

This property is available for MSMQ 2.0 and later. It is used by receiving applications to verify that a message was the last message sent in a single transaction to a single queue.

You can use IsLastInTransaction along with two other properties to verify transaction boundaries. These two properties are a property for checking the first message sent in a transaction and a property for retrieving the identifier of the transaction: MSMQMessage.IsFirstInTransaction and MSMQMessage.TransactionId.

If only one message is sent in a transaction, both IsLastInTransaction and MSMQMessage.IsFirstInTransaction are set.

In C++ COM applications, you must use a smart pointer to the IMSMQMessage2 or IMSMQMessage3 interface to expose the IsLastInTransaction property.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_LAST_IN_XACT.

For information on See
How transaction boundaries can be used Checking for Transaction Boundaries when Receiving Messages
Checking the first message in the transaction MSMQMessage.IsFirstInTransaction
Retrieving the identifier of the transaction MSMQMessage.TransactionId

Requirements

Windows NT/2000/XP: Included in Windows 2000 and later.

Windows 95/98/Me: Unsupported.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib

See Also

MSMQMessage
MSMQMessage.IsFirstInTransaction
MSMQMessage.TransactionId
PROPID_M_LAST_IN_XACT