Microsoft DirectX 9.0 SDK Update (Summer 2003)

PFNDPNMESSAGEHANDLER Prototype


PFNDPNMESSAGEHANDLER is an application-defined callback function used by the IDirectPlay8Peer, IDirectPlay8Client, IDirectPlay8Server, IDirectPlay8LobbyClient, and IDirectPlay8LobbiedApplication interfaces to process messages.

Syntax

typedef HRESULT (CALLBACK *PFNDPNMESSAGEHANDLER)(      

    PVOID pvUserContext,     DWORD dwMessageType,     PVOID pMessage );

Parameters

pvUserContext
Pointer to the application-defined structure that will be passed to this callback function. This is defined in the pvUserContext parameter of the Initialize method.
dwMessageType
One of the following DPN_ message types that are generated by the IDirectPlay8Peer, IDirectPlay8Client, and IDirectPlay8Server interfaces. Each interface uses a different subset of the available DPN_ messages. Refer to the interface documentation for details. Additionally, if the application supports Microsoft® DirectPlay® lobby functionality, this parameter can specify one of the following DPL_ message types that are generated by the IDirectPlay8LobbyClient and IDirectPlay8LobbiedApplication interfaces. Each lobby interface uses a different subset of the available DPL_ messages. Refer to the interface documentation for details.
DPN_MSGID_ADD_PLAYER_TO_GROUP
DPN_MSGID_ASYNC_OP_COMPLETE
DPN_MSGID_CLIENT_INFO
DPN_MSGID_CONNECT_COMPLETE
DPN_MSGID_CREATE_GROUP
DPN_MSGID_CREATE_PLAYER
DPN_MSGID_DESTROY_GROUP
DPN_MSGID_DESTROY_PLAYER
DPN_MSGID_ENUM_HOSTS_QUERY
DPN_MSGID_ENUM_HOSTS_RESPONSE
DPN_MSGID_GROUP_INFO
DPN_MSGID_HOST_MIGRATE
DPN_MSGID_INDICATE_CONNECT
DPN_MSGID_INDICATED_CONNECT_ABORTED
DPN_MSGID_PEER_INFO
DPN_MSGID_RECEIVE
DPN_MSGID_REMOVE_PLAYER_FROM_GROUP
DPN_MSGID_RETURN_BUFFER
DPN_MSGID_SEND_COMPLETE
DPN_MSGID_SERVER_INFO
DPN_MSGID_TERMINATE_SESSION
DPL_MSGID_CONNECT
DPL_MSGID_CONNECTION_SETTINGS
DPL_MSGID_DISCONNECT
DPL_MSGID_RECEIVE
DPL_MSGID_SESSION_STATUS
pMessage
Structure containing message information.

Return Value

See the documentation for the individual messages for appropriate return values. Unless otherwise noted, this function should return S_OK.



Remarks

This function must be threadsafe because it might be called reentrantly through multiple threads.

Callback messages from the same player are serialized. When you receive a message from a player, you will not receive another until you have handled the first message, and the callback function has returned.

The message structures have the same name as the message type except the "DPN_MSGID" is replaces with "DPNMSG". For example, the DPN_MSGID_TERMINATE_SESSION message type uses the DPNMSG_TERMINATE_SESSION message structure to convey the actual message information.

When implementing this callback function, first view the message type returned in the dwMessageType parameter and then cast the message structure (pMessage) to that type to obtain message information. Some messages don't have a defined structure because they have no parameters. For these messages, the pMessage parameter is NULL.

Prototype Information

Headerdplay8.h
Import libraryNone
Minimum operating systems Windows 98, Pocket PC 2002


© 2003 Microsoft Corporation. All rights reserved.