共用方式為


PROPID_M_LOOKUPID

 

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

(Read-only, introduced in MSMQ 3.0.) The PROPID_M_LOOKUPID property indicates the lookup identifier of the message.

Property ID

PROPID_M_LOOKUPID

Type Indicator

VT_UI8

MQPROPVARIANT Field

uhVal.QuadPart

Property Value

A 64-bit local number that is unique to the queue where the message resides. The uhVal member of the MQPROPVARIANT structure is a ULARGE_INTEGER union. The QuadPart member of this union stores a 64-bit unsigned integer of type ULONGLONG.

Remarks

The PROPID_M_LOOKUPID property is a 64-bit, local number that is set by the target queue manager when the queue manager places the message in the queue. The receiving application can use the lookup identifier when calling the MQReceiveMessageByLookupId function to peek at or retrieve the message from the queue without navigating the queue. For information on peeking at or retrieving messages based on their lookup identifiers, see Navigating with Lookup Identifiers.

Obtaining the lookup identifiers of the messages in the queue is the responsibility of the application. One possible way to obtain the lookup identifiers is to create a trigger for the destination queue that invokes a component that caches the identifiers of each message as they are placed in the queue.

To retrieve the lookup identifier of a message, include PROPID_M_LOOKUPID in the MQMSGPROPS structure, then call MQReceiveMessage and examine the returned values. When retrieving this property, the type indicator can be set to VT_UI8 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI8 during the function call.

Equivalent COM Property

With COM components, the equivalent property for retrieving the lookup identifier of the message is MSMQMessage.LookupId.

Example Code

The following code fragment shows how PROPID_M_LOOKUPID is specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving the lookup identifier.

aMsgPropID[i] = PROPID_M_LOOKUPID;             // Property identifier  
aMsgPropVar[i].vt = VT_NULL;                   // Type indicator  
i++;  

The following example is included in Using Message Queuing.

For an example of See
Obtaining and using the lookup identifier of a message C/C++ Code Example: Navigating Using Lookup Identifiers

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MSMQMessage.LookupId