Microsoft DirectX 8.1 (Visual Basic)

Communicating with DirectPlay Objects

Microsoft® DirectPlay® essentially consists of a collection of COM objects. Each object exposes one or more interfaces that enable you to control various aspects of DirectPlay. For instance, the DirectPlay peer object (CLSID_DirectPlay8Peer) is used to manage peer-to-peer games.

You communicate with a DirectPlay object by calling the methods exposed by its interfaces. For instance, to send some data to another user in a peer-to-peer game, you would send a message by calling the DirectPlay8Peer.SendTo method. DirectPlay then takes care of getting the message to its target.

DirectPlay communicates with your application through one or more message handlers. A message handler is an object that DirectPlay calls to notify your application of various events. The documentation describes the methods that are exposed by the object, but you must implement all of the objects methods in your application. You then register the object during startup, and DirectPlay will call the object's methods to notify you when an event has occurred. Additional information about the event is passed through the method's parameters.