PeerGroupRegisterEvent function (p2p.h)

The PeerGroupRegisterEvent function registers a peer for specific peer group events.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGroupRegisterEvent(
  [in]  HGROUP                        hGroup,
  [in]  HANDLE                        hEvent,
  [in]  DWORD                         cEventRegistration,
  [in]  PEER_GROUP_EVENT_REGISTRATION *pEventRegistrations,
  [out] HPEEREVENT                    *phPeerEvent
);

Parameters

[in] hGroup

Handle of the peer group on which to monitor the specific peer events. This handle is returned by the PeerGroupCreate, PeerGroupOpen, or PeerGroupJoin function. This parameter is required.

[in] hEvent

Pointer to a Windows  event handle, which is signaled when a peer event is fired. When this handle is signaled, the peer should call PeerGroupGetEventData until the function returns PEER_S_NO_EVENT_DATA. This parameter is required.

[in] cEventRegistration

Contains the number of PEER_GROUP_EVENT_REGISTRATION structures listed in pEventRegistrations. This parameter is required.

[in] pEventRegistrations

Pointer to a list of PEER_GROUP_EVENT_REGISTRATION structures that contains the peer event types for which registration occurs. This parameter is required.

[out] phPeerEvent

Pointer to the returned HPEEREVENT handle. A peer can unregister for this peer event by passing this handle to PeerGroupUnregisterEvent. This parameter is required.

Return value

Returns S_OK if the operation succeeds. Otherwise, the function 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 available to complete the operation.
PEER_E_INVALID_GROUP
The handle to the group is invalid.
 

Cryptography-specific errors can be returned from the Microsoft RSA Base Provider. These errors are prefixed with CRYPT_* and defined in Winerror.h.

Remarks

Before you close the HPEEREVENT handle, you must unregister for the peer event types by passing the handle to PeerGroupUnregisterEvent.

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 P2P.lib
DLL P2P.dll

See also

PEER_GROUP_EVENT_DATA

PEER_GROUP_EVENT_REGISTRATION

PeerGroupCreate

PeerGroupGetEventData

PeerGroupJoin

PeerGroupOpen

PeerGroupUnregisterEvent