DirectX SDK

DirectPlay4.SetGroupData

The DirectPlay4.SetGroupData method associates an application-specific data block with a group ID. Only the computer that created the group can change the remote data associated with it.

object.SetGroupData(GroupId As Long, _
    data As String, _
    flags As CONST_DPSETFLAGS)

Parameters

object
Object expression that resolves to a DirectPlay4 object.
GroupId
Group ID for which data is being set.
data
Data to be stored. Set to "" to clear any existing data.
flags
Flags from the CONST_DPGETCAPSFLAGS enumeration indicating how the group data is propagated. If this parameter is set to 0, the remote group data will be set and propagated using nonguaranteed messaging.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDGROUP
DPERR_INVALIDOBJECT
DPERR_INVALIDPARAMS

Remarks

DirectPlay can maintain two types of group data: local and remote. Local data is available only to the application on the local computer. Remote data is propagated to all the other applications in the session. A DPSYS_SETPLAYERORGROUPDATA system message will be sent to all players (including the sender) notifying them of the change unless DPSESSION_NODATAMESSAGES is set in the session description. You can safely store pointers to resources in the local data; the local data block is available (in the DPSYS_DESTROYPLAYERORGROUP system message) when the group is being destroyed, so that the application can free those resources.

This method should not be used for updating real-time information (such as position updates) because of the overhead introduced. DirectPlay4.Send is much more efficient for updating real-time information. SetGroupData is more appropriate for shared-state information that does not change often and is not time-critical (such as a team color).

See Also

DirectPlay4.GetGroupData