Share via


MSMQQueueInfos.Next

 

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 Next method of the MSMQQueueInfos object, which represents a query, returns an MSMQQueueInfo object that represents the next queue in the collection of public queues satisfying the search criteria of the query.

Function Next
() As MSMQQueueInfo  

Parameters

This method has no parameters.

Return Values

An MSMQQueueInfo object that represents a single public queue in the collection of public queues satisfying the search criteria of the query (in C++, a smart pointer to the IMSMQQueueInfo interface).

Error Codes

For information on return codes, see Message Queuing Error and Information Codes.

Remarks

The MSMQQueueInfos object is created and initialized by a call to the MSMQQuery.LookupQueue method.

The application must call Next to point the cursor to the first queue in the collection of public queues that satisfy the search criteria of the query, and then retrieve the properties of the first queue. After the cursor is pointing at the first queue, Next can be called repeatedly to enumerate all the remaining elements of the collection.

Next returns Null if there are no queues in the collection or the cursor is at the end of the collection (EOL).

Example Code

The following code fragment displays the path names of all the public queues with a specific service type GUID.

Dim query as New MSMQQuery  
Dim qinfos as MSMQQueueInfos  
Dim qinfoCurrent as MSMQQueueInfo  
Set qinfos = query.LookupQueue( _  
    ServiceTypeGuid:="{3FC5958E-A9D8-4EC7-9148-C5B446CF9F87}")  
Set qinfoCurrent = qinfos.Next  
While Not qinfoCurrent Is Nothing  
    MsgBox qinfoCurrent.PathName  
    Set qinfoCurrent = qinfos.Next  
Wend  

The following example is included in Using Message Queuing.

For an example of See
Locating a set of public queues based on the queue label C++ COM Code Example: Locating a Queue

 Visual Basic Code Example: Locating a Queue

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

MSMQQuery.LookupQueue
MSMQQueue.Reset
MSMQQueueInfo
MSMQQueueInfos