PeerGraphGetNextItem, fonction (p2p.h)

La fonction PeerGraphGetNextItem obtient le ou les éléments suivants dans une énumération créée par un appel aux fonctions suivantes, qui retournent un handle d’énumération d’homologue :

Syntaxe

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGraphGetNextItem(
  [in]      HPEERENUM hPeerEnum,
  [in, out] ULONG     *pCount,
  [out]     PVOID     **pppvItems
);

Paramètres

[in] hPeerEnum

Gérez une énumération.

[in, out] pCount

Input spécifie le nombre d’éléments à obtenir.

La sortie reçoit le nombre réel d’éléments obtenus.

Note Si pCount est une sortie zéro (0), la fin de l’énumération est atteinte.
 

[out] pppvItems

Reçoit un tableau de pointeurs vers les éléments demandés. Le nombre de pointeurs contenus dans un tableau est spécifié par la valeur de sortie de pCount. Les données réelles retournées dépendent du type d’énumération. Les types de structures retournés sont les suivants : PEER_CONNECTION_INFO, PEER_NODE_INFO et PEER_RECORD

Valeur retournée

Si l’appel de fonction réussit, la valeur de retour est S_OK. Sinon, elle retourne l’une des valeurs suivantes.

Code de retour Description
E_INVALIDARG
Un paramètre n’est pas valide.
E_OUTOFMEMORY
La mémoire est insuffisante pour effectuer une opération spécifiée.
PEER_E_NOT_INITIALIZED
Le graphe doit être initialisé avec un appel à PeerGraphStartup avant d’utiliser cette fonction.

Remarques

Libérez ppvItems en appelant PeerGraphFreeData lorsque les données ne sont plus nécessaires.

L’application peut demander une plage d’éléments à obtenir. La fonction retourne pCount ou moins d’éléments.

Exemples

L’extrait de code suivant vous montre comment utiliser PeerGraphGetNextItem pour énumérer des objets et mettre fin à une énumération une fois que vous avez terminé le traitement de l’énumération.

//PeerGraphGetNextItem snippet
    // hPeerEnum is a handle to the enumeration obtained from a successful call to PeerGraphEnumConnections,
    // PeerGraphEnumNodes, PeerGraphEnumRecords, or PeerGraphSearchRecords.
    // Set count equal to the maximum number of items you want returned. To obtain a count of all the items
    // in the enumeration, call PeerGraphGetItemCount.
    // ppRecord is an array of pointers to PEER_RECORD objects.  PEER_CONNECTION_INFO and PEER_NODE_INFO structures
    // are also supported.
    HRESULT hr = PeerGraphGetNextItem(hPeerEnum, &count, (PVOID *)&ppRecord);
    if (FAILED(hr))
    {
        // Insert your code to handle the error here.
    }
    else
    {
        // Free the data obtained by PeerGraphGetNextItem.
        PeerGraphFreeData(ppRecord);
    }

    // If you are done with the enumeration, free the handle to the enumeration.
    PeerGraphEndEnumeration(hPeerEnum);

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows XP avec SP2 [applications de bureau uniquement],Windows XP avec SP1 avec le pack de mise en réseau avancé pour Windows XP
Serveur minimal pris en charge Aucun pris en charge
Plateforme cible Windows
En-tête p2p.h
Bibliothèque P2PGraph.lib
DLL P2PGraph.dll

Voir aussi

PEER_CONNECTION_INFO

PEER_NODE_INFO

PEER_RECORD

PeerGraphEndEnumeration

PeerGraphEnumConnections

PeerGraphEnumNodes

PeerGraphEnumRecords

PeerGraphFreeData

PeerGraphSearchRecords