## DirectPlay Interface Overviews

DirectPlay is composed of objects and interfaces based on the component object model (COM). COM is a foundation for an object-based system that focuses on the reuse of interfaces, and it is the model at the heart of OLE programming. It is also an interface specification from which any number of interfaces can be built.

New methods and functionality are exposed in COM through the use of new interfaces that are sequentially numbered. The current DirectPlay interface is called IDirectPlay3. The old interfaces, IDirectPlay and IDirectPlay2, still exist for backward compatibility with applications written to those interfaces.

This section contains general information about the following DirectPlay COM interfaces:

- Unicode vs. ANSI Interfaces
- IDirectPlay Interface
- IDirectPlay2 Interface
- IDirectPlay3 Interface
- IDirectPlayLobby Interface
- IDirectPlayLobby2 Interface

### Unicode vs. ANSI Interfaces

DirectPlay supports both Unicode and ANSI strings by defining string pointers in a structure as the union of a Unicode string pointer (LPWSTR) and an ANSI string pointer (LPSTR). The two string pointers have different names. Typically, the ANSI member ends with the letter "A". Depending on which IDirectPlay interface is chosen (IDirectPlay3 Interface for Unicode or IDirectPlay3A for ANSI), or which IDirectPlayLobby2 interface is chosen (IDirectPlayLobby2 Interface for Unicode or IDirectPlayLobby2A for ANSI), the application should read and write the appropriate strings from the structure and ignore the other one.

### IDirectPlay Interface

The IDirectPlay COM interface remains part of DirectPlay version 5. It contains the methods required to run applications that were written for the DirectX SDK versions 1 and 2. Although you could use this interface to create new applications, it is recommended that you use the newer DirectPlay interfaces, IDirectPlay3 Interface and IDirectPlay3A, to take advantage of their increased functionality.

### IDirectPlay2 Interface

The IDirectPlay2 COM interface remains part of DirectPlay version 5. It contains the methods required to run applications that were written for the DirectX SDK version 3. Although you could use this interface to create new applications, it is recommended that you use the newer DirectPlay interfaces, IDirectPlay3 Interface and IDirectPlay3A, to take advantage of their increased functionality.

### IDirectPlay3 Interface

IDirectPlay3 is the latest interface. It directly inherits from IDirectPlay2, so any code written for IDirectPlay2 will work with IDirectPlay3 with no modification.

The new methods in IDirectPlay3 are:

- AddGroupToGroup
- CreateGroupInGroup
- DeleteGroupFromGroup
- EnumConnections
- EnumGroupsInGroup
- GetGroupConnectionSettings
- GetGroupFlags
- GetGroupParent
- GetPlayerAccount
- GetPlayerFlags
- InitializeConnection
- SecureOpen
- SendChatMessage
- SetGroupConnectionSettings
- StartSession

### IDirectPlayLobby Interface

The IDirectPlayLobby COM interface remains part of DirectPlay version 5. It contains the methods required to run applications that were written for the DirectX SDK versions 1 and 2. Although you could use this interface to create new applications, it is recommended that you use the newer DirectPlay interface, IDirectPlayLobby2 Interface, to take advantage of its increased functionality.

### IDirectPlayLobby2 Interface

The IDirectPlayLobby2 Interface interface lets game developers launch external applications, enable communication between an application and a lobby client, and manipulate DirectPlay Addresses.

IDirectPlayLobby2 supports all the methods of IDirectPlayLobby. See Building Lobby-Aware Applications for information about detecting a launch by an external lobby and registering lobby-aware applications. See DirectPlay Lobby Overview for general information about lobby sessions.

The new method in IDirectPlayLobby2 is:

- CreateCompoundAddress

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.