3.14 AllMessagesIterator

Iterates over the messages in an AllMessages collection, successively returning each message. Multiple AllMessagesIterator objects can be simultaneously active over the same collection. Each iterator maintains its own internal position and does not affect the state of the collection it is iterating.

3.14.1 Properties

The following table lists properties along with their access and descriptions.






Application. The Application object.



AllMessages collection. The collection over which this AllMessageIterator iterates.

3.14.2 Methods

AllMessagesIterator Clone()

Creates another, independent AllMessagesIterator object. The clone starts at the original object’s current position in the collection. Use Clone() to save the current position before a Skip or Reset.

Message Next()

Returns the next message in the collection or nothing after the last message.


Resets an iterator so that Next returns the first message in the collection.

Skip(Long NumMessages)

Skips the next NumMessages messages. Skip does nothing if there are not NumMessages messages left to skip, or if NumMessages < 0.

3.14.3 Remarks

Both AllMessagesIterator and IEnumVARIANT (from the AllMessages collection _NewEnum method) allow iterating an AllMessages collection. However, AllMessagesIterator is an object available in all object-oriented development environments, while IEnumVARIANT is a COM interface inaccessible in environments such as Delphi. The usual alternative to IEnumVARIANT is:

for i:= 1 to Count

This does not work with large collections, such as AllMessages, which do not support Count or Item.

The AllMessagesIterator object does not support a Refresh method.