FormatName
MSMQQueueInfo

The FormatName property specifies the format name of the queue. This property must be set before the queue is opened.

When creating a queue, if a format name is not provided by the application, MSMQ generates one from the queue's MSMQ pathname (PathName). After the queue is created, you can use the name generated by MSMQ or specify a different one.

Type: String
Run time: read/write

Syntax

object.FormatName
 
Syntax Element Description
object The queue (MSMQQueueInfo) object in question.

Settings

String. Possible strings are:

PUBLIC=QueueGUID
DIRECT=Protocol:MachineAddress\QueueName
DIRECT=OS:MachineName\QueueName
PRIVATE=MachineGUID\QueueNumber
 

Remarks

The FormatName property must be specified to open the queue. MSMQ uses the queue's format name to identify which queue to open and how to access the opened queue. A queue's format name cannot be changed while the queue is open.

For information on how MSMQ uses format names, see Format Name.

Example

This example creates a private queue on the local computer, and then opens the queue with the format name provided by MSMQ. To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, 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 = ".\PRIVATE$\FormatNameTest"
  qinfo.Label = "Test Queue"
  qinfo.Create
  
  MsgBox "Queue format name is: " + qinfo.FormatName
   
  Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
  
  On Error GoTo ErrorHandler

End Sub
 

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mqoai.h.
  Import Library: Use mqoa.lib.
  Unicode: Defined only as Unicode.

See Also

Create, IsOpen, Label, MSMQQueue, MSMQQueueInfo, Open, PathName