Microsoft DirectX 9.0

IDirectPlay8Peer::AddPlayerToGroup Method

Adds a peer to a group.

When this method is called, all peers connected to the application receive a DPN_MSGID_ADD_PLAYER_TO_GROUP message.


HRESULT AddPlayerToGroup(      

    const DPNID idGroup,     const DPNID idClient,     PVOID const pvAsyncContext,     DPNHANDLE *const phAsyncHandle,     const DWORD dwFlags );


[in] Variable of type DPNID that specifies the identifier of the group to add the peer to.
[in] Variable of type DPNID that specifies the identifier of the peer that is added to the group.
[in] Pointer to the user-supplied context, which is returned in the pvUserContext member of the DPN_MSGID_ASYNC_OP_COMPLETE system message. This parameter is optional and may be set to NULL.
[out] A DPNHANDLE. A value will be returned. However, Microsoft?DirectPlay?does not permit cancellation of this operation, so the value cannot be used.
[in] Flag that controls how this method is processed. The following flag can be set for this method.
Causes the method to process synchronously.

Return Value

Returns S_OK if this method is processed synchronously and is successful. By default, this method runs asynchronously and usually returns DPNSUCCESS_PENDING. It may also return one of the following error values.

DPNERR_INVALIDFLAGSThe flags passed to this method are invalid.
DPNERR_INVALIDGROUPThe group ID is not recognized as a valid group ID for this game session.
DPNERR_INVALIDPLAYERThe player ID is not recognized as a valid player ID for this game session.
DPNERR_PLAYERALREADYINGROUPThe player ID is already included in the group.


Any peer can add itself or another peer to an existing group. Once the peer is successfully added to the group, all messages sent to the group are also sent to the peer.

© 2002 Microsoft Corporation. All rights reserved.