PeerGraphRegisterEvent function (p2p.h)

The PeerGraphRegisterEvent function registers a peer's request to be notified of changes associated with a peer graph and event type.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGraphRegisterEvent(
  [in]  HGRAPH                        hGraph,
  [in]  HANDLE                        hEvent,
  [in]  ULONG                         cEventRegistrations,
  [in]  PEER_GRAPH_EVENT_REGISTRATION *pEventRegistrations,
  [out] HPEEREVENT                    *phPeerEvent
);

Parameters

[in] hGraph

Handle to the peer graph.

[in] hEvent

Handle created by CreateEvent that the application is signaled on when an event is triggered. When an application is signaled, it must call PeerGraphGetEventData to retrieve events until PEER_S_NO_EVENT_DATA returned.

[in] cEventRegistrations

Specifies the number of PEER_GRAPH_EVENT_REGISTRATION structures in pEventRegistrations.

[in] pEventRegistrations

Points to an array of PEER_GRAPH_EVENT_REGISTRATION structures that specify what events the application requests notifications for.

[out] phPeerEvent

Receives a HPEEREVENT handle. This handle must be used when calling PeerGraphUnregisterEvent to stop receiving notifications.

Return value

If the function call succeeds, the return value is S_OK. Otherwise, it returns one of the following values.

Return code Description
E_INVALIDARG
One of the parameters is not valid.
E_OUTOFMEMORY
There is not enough memory to perform the specified operation.
PEER_E_INVALID_GRAPH
The handle to the peer graph is invalid.
PEER_E_NOT_INITIALIZED
The peer graph must be initialized with a call to PeerGraphStartup before using this function.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only],Windows XP with SP1 with the Advanced Networking Pack forWindows XP
Minimum supported server None supported
Target Platform Windows
Header p2p.h
Library P2PGraph.lib
DLL P2PGraph.dll

See also

PEER_GRAPH_EVENT_REGISTRATION

PeerGraphGetEventData

PeerGraphUnregisterEvent