SentTime
MSMQMessage

Read-only. The SentTime property indicates when a message was sent.

Quick Info

Type: Date Variant
Run time: read-only

Syntax

object.SentTime
 
Syntax Element Description
object Message (MSMQMessage) object that defines the message.

Return Values

Date message was sent.

Remarks

The returned value for this property can be manipulated using standard Microsoft® Visual Basic® date and time functions such as Date$, and Time$. For descriptions of Visual Basic functions, see the Visual Basic documentation.

When SentTime is displayed, Visual Basic will automatically convert the parameter's value to the local system time and system date.

Example

This example locates a destination queue (creating one if one does not exist), sends a message to the queue, then reads the message and displays when the message was sent.

To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, and then run the example and click the form.

Dim query As New MSMQQuery
Dim qinfos As MSMQQueueInfos
Dim qinfoDest As MSMQQueueInfo
Dim qDest As MSMQQueue
Dim msgSent As New MSMQMessage
Dim msgRead As MSMQMessage


Private Sub Form_Click()
   
   
   '**********************************
   ' Locate destination queue
   '(create one if one doesn't exist).
   '**********************************
   Set qinfos = query.LookupQueue(Label:="Destination Queue")
   qinfos.Reset
   Set qinfoDest = qinfos.Next
   If qinfoDest Is Nothing Then
      Set qinfoDest = New MSMQQueueInfo
      qinfoDest.PathName = ".\DestQueue"
      qinfoDest.Label = "Destination Queue"
      qinfoDest.Create
   End If
   
   '**************
   ' Send Message.
   '**************
   Set qDest = qinfoDest.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
   msgSent.Label = "Test Message"
   msgSent.Body = "This message tests the message timers."
   msgSent.Send qDest
   qDest.Close
        
   '******************************************
   ' Remove the message from destination queue
   ' and display when the message was sent.
   '******************************************
   Set qDest = qinfoDest.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
   Set msgRead = qDest.Receive
   
   MsgBox "The message was sent at: " + CStr(msgRead.SentTime)
    
End Sub
 

See Also

Body, Close, Create, Label, LookupQueue, MSMQMessage, MSMQQuery, MSMQQueue, MSMQQueueInfo, MSMQQueueInfos, Next, Open, PathName, Receive, Send


© 1997 by Microsoft Corporation. All rights reserved.