Creates a local player for the current session.
HRESULT CreatePlayer(
LPDPID lpidPlayer,
LPDPNAME lpPlayerName,
HANDLE hEvent,
LPVOID lpData,
DWORD dwDataSize,
DWORD dwFlags
);
Returns DP_OK if successful, or one of the following error values otherwise:
A single process can have multiple local players that communicate through a DirectPlay object with other players on the same computer or players on remote computers.
Upon successful completion, this method sends a DPMSG_CREATEPLAYERORGROUP system message to all the other players in the session announcing that a new player has joined the session. By default, all local players receive copies of all the system messages.
Your application should use the player ID returned to the application to identify the player for message passing and data association. Player and group IDs assigned by DirectPlay will always be unique within the session.
If the application closes the session, any local players created will be automatically destroyed. Only the application that created the player can:
If the application uses a separate thread to retrieve DirectPlay messages, it is highly recommended that a non-NULL hEvent be supplied and used for synchronization. This event will be set when this player receives a message. Within the message receive thread, use the Win32 API WaitForSingleObject (or use WaitForMultipleObjects if more than one event is used) within the thread to determine if a player has messages. It is inefficient to loop on IDirectPlay3::Receive inside a separate thread waiting for a message. The same event can be used for all the local players, or the application can supply different events for each player. The application is responsible for creating and destroying the event. See Synchronization for more information.
DPNAME, DPMSG_CREATEPLAYERORGROUP, IDirectPlay3::DestroyPlayer, IDirectPlay3::EnumPlayers, IDirectPlay3::Receive, IDirectPlay3::Send, IDirectPlay3::SetPlayerData, IDirectPlay3::SetPlayerName, IDirectPlay3::GetPlayerFlags
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.