Step 1: Creating the DirectPlay Object
Before any methods can be called, the application must create an interface to a DirectPlay object.
The following example shows how the create the IDirectPlay3A interface:
HRESULT CreateDirectPlayInterface( LPDIRECTPLAY3A *lplpDirectPlay3A )
{
HRESULT hr;
LPDIRECTPLAY3A lpDirectPlay3A = NULL;
// Create an IDirectPlay3 interface
hr = CoCreateInstance( CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectPlay3A, (LPVOID*)&lpDirectPlay3A);
// Return interface created
*lplpDirectPlay3A = lpDirectPlay3A;
return (hr);
}