共用方式為


PROPID_M_SENTTIME

 

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.) The PROPID_M_SENTTIME property indicates the date and time when the message was sent by the source queue manager.

Property ID

PROPID_M_SENTTIME

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Remarks

The PROPID_M_SENTTIME property is attached to the message by Message Queuing. The time returned is the number of seconds elapsed since midnight (00:00:00), January 1, 1970 (Coordinated Universal Time) according to the system clock.

To see when a message was sent, specify PROPID_M_SENTTIME in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value. The type indicator of this property can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

Microsoft provides several time functions that can be used to manipulate the returned Coordinated Universal time value. These functions are defined in the time.h header file.

Equivalent COM Property

With COM components, the equivalent property for retrieving the time when a message was sent is MSMQMessage.SentTime.

Example Code

The following code fragment shows how PROPID_M_SENTTIME is specified in arrays that can be used to initialize an MQMSGPROPS structure.

aMsgPropId[i] = PROPID_M_SENTTIME;           // Property ID  
aMsgPropVar[i].vt = VT_NULL;                 // Type indicator  
i++;  

The following example is included in Using Message Queuing.

For an example of See
Filtering messages based on the time they were sent to the queue C/C++ Code Example: Time Sent Filters

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
PROPID_M_ARRIVEDTIME