Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Advances the enumerator to the next item in the collection.
Syntax
HRESULT MoveNext(
[out, retval] boolean *hasCurrent
);
Parameters
hasCurrent [out, retval]
Type: boolean*TRUE if the iterator refers to a valid item that is in the collection; otherwise, FALSE if the iterator is at the end of the collection.
Return value
Type: HRESULT
This method can return one of these values.
Return code | Description |
---|---|
S_OK | The current item was retrieved successfully. |
E_CHANGED_STATE | The iterator has been invalidated. |
E_BOUNDS | The iterator refers to an item that is not valid or is at the end of the collection. |
Examples
The following code example demonstrates how to use the MoveNext method.
comptr<Folder> spFolder;
hr = GetKnownFolder(FOLDERID_MusicFolder, &spFolder);
//...
comptr<IVectorView<IShellItem2>> spItems;
hr = pFolder->GetItems(&spItems);
//...
comptr<IIterator<IShellItem2>> spIter;
hr = spItems->First(&spIter);
//...
bool hasCurrent;
for (hr = spIter->get_HasCurrent(&hasCurrent);
SUCCEEDED(hr) && hasCurrent;
hr = spIter->MoveNext(&hasCurrent))
{
comptr<IShellItem2> spAnItem;
hr = spIter->get_Current(&spAnItem)
//...
}
Requirements
Minimum supported client |
Windows 8 |
Minimum supported server |
Windows Server 2012 |
Header |
Windows.Foundation.Collections.h |