The Next method returns the next queue in the collection.
object.Next
Syntax Element | Description |
---|---|
object | Collection that contains the queues. |
MSMQQueueInfo object.
For information on return codes, see MSMQ Error and Information Codes.
When the cursor is pointing to the front of the query results (for example, Reset has been called), call Next to point to the first queue in the query.
Returns NULL if the cursor is at the end of the collection (EOL).
This example assumes that at least one queue whose label is "Test Queue" already exists. It runs a query for the test queues, displaying the format name of each queue it finds.
To try this example using Microsoft® Visual Basic® (version 5.0), make sure the Microsoft Message Queue Object Library is referenced, paste the following Code into the code window of a form, run the example, and click the form.
Dim query As New MSMQQuery
Dim qinfos As MSMQQueueInfos
Dim qinfo As MSMQQueueInfo
Private Sub Form_Click()
Set qinfos = query.LookupQueue(Label:="Test Queue")
qinfos.Reset
Set qinfo = qinfos.Next
While Not qinfo Is Nothing
MsgBox "I found a Test Queue! its Format name is: " + qinfo.FormatName
Set qinfo = qinfos.Next
Wend
End Sub
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.
FormatName, Label, MSMQQuery, MSMQQueueInfo, MSMQQueueInfos, Next, Reset