Read-only. The ShareMode property indicates the share mode of the queue.
Type: | Long |
Run time: | read-only |
object.ShareMode
Syntax Element | Description |
object | Queue (MSMQQueue) object that represents the open instance of the queue. |
The ShareMode property returns one of the following values:
The ShareMode property returns the share mode of the queue when it was last opened, regardless if the queue is currently opened or closed.
When ShareMode returns MQ_DENY_NONE, several users can be using the queue at the same time.
This example opens a queue for sending messages, then uses the value of ShareMode to test who can use the queue (with what share mode). 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 qinfo As MSMQQueueInfo Dim q As MSMQQueue Private Sub Form_Click() Set qinfo = New MSMQQueueInfo qinfo.PathName = ".\lShareModeTest" qinfo.Label = "Test Queue" qinfo.Create Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) Select Case q.ShareMode Case MQ_DENY_NONE MsgBox "The queue is open for multiple users." Case MQ_DENY_RECEIVE_SHARE MsgBox "The queue is only open for this process." Case Else MsgBox "Not a valid return value!" End Select q.Close End Sub
Close, Create, Label, MSMQQueue, MSMQQueueInfo, Open, PathName