HRESULT CreateGroup(LPDPID lpidGroup,
LPDPNAME lpGroupName, LPVOID lpData,
DWORD dwDataSize, DWORD dwFlags);
Creates a logical group of players in the current session.
·Returns DP_OK if successful, or one of the following error values otherwise:
lpidGroup
Address of a variable that will be filled with the DirectPlay group ID. This value is defined by DirectPlay.
lpGroupName
Address of a DPNAME structure that holds the name of the group. NULL indicates that the group has no initial name.
lpData
Address of a block of application-defined remote data to associate with the group ID. NULL indicates that the group has no initial data. The data specified here is assumed to be remote data that will be propagated to all the other applications in the session as if IDirectPlay2::SetGroupData were called.
dwDataSize
Size, in bytes, of the data block that lpData points to.
dwFlags
Reserved; do not use.
Messages can be sent to a group, and DirectPlay will forward the message to every player in the group. The group ID returned to the application should be used to identify the group for message passing and data association. Player and group IDs assigned by DirectPlay will always be unique within the session. This method will generate a DPSYS_CREATEPLAYERORGROUP system message that will be sent to all the other players. For a list of system messages, see Using System Messages.
The application can associate an initial name with the group at creation by using the IDirectPlay2::SetGroupName method. The names in lpGroupName are provided for human use only; they are not used internally and need not be unique. The application can also associate initial data with the group creation by using the IDirectPlay2::SetGroupData method.