Delen via


MSMQQueueInfos

 

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

The MSMQQueueInfos object represents a query and provides methods for querying the directory service to locate existing public queues that satisfy the search criteria specified in the query. The MSMQQueueInfos object is created and initialized by the MSMQQuery.LookupQueue method. The MSMQQueueInfos.Next method moves the cursor to the first queue in the collection of public queues that satisfy the search criteria of the query and returns an MSMQQueueInfo object that represents the first queue. Next can be called repeatedly to enumerate all the elements of the collection.

The collection of public queues that satisfies the search criteria specified in a query is dynamic, with other clients altering the properties of the queues or deleting them from the collection at any time. As a consequence, there is no queue count available for enumerating the elements of the collection. In place of a queue count, MSMQQueueInfos provides an end-of-list (EOL) mechanism to indicate when you have completely enumerated the elements of the collection.

The following example shows how the EOL mechanism is used in a standard Microsoft® Visual Basic® type While loop.

' Display the format names of all queues  
' with the label "examplequeue".  
Dim queryMyQuery As New MSMQQuery  
Dim qinfoCurrent As MSMQQueueInfo  
' Get some interesting queues.  
Dim qinfos As MSMQQueueInfos  
Set qinfos = queryMyQuery.LookupQueue( _  
    Label:="examplequeue")  
Set qinfoCurrent = qinfos.Next  
While Not qinfoCurrent Is Nothing  
    MsgBox qinfoCurrent.FormatName  
    Set qinfoCurrent = qinfos.Next  
Wend  

Methods

The MSMQQueueInfos object defines the following methods.

Method Description
MSMQQueueInfos.Next Returns an MSMQQueueInfo object that represents the next queue in the collection of public queues satisfying the search criteria of the query.
MSMQQueueInfos.Reset Moves the cursor to the position before the first queue in the collection of public queues satisfying the search criteria of the query.

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

Message Queuing COM Components
MSMQQuery
MSMQQuery.LookupQueue