Implementing First Play

Once you have created the data and navigation objects, you can begin to play back data from the DVD-Video volume. The simplest approach to doing this is to create a window for your application, start playing from the first play domain, and then go into a normal message-processing loop.

Creating an Application Window

The following code example contains the routine steps for opening a window.

// Because the hInstance is needed a lot, store it in a global
// instead of passing it around.
g_hInstance = hInstance;

// Create the main application window.  
if (!CreateMainWindow (TEXT("DVDPLAY"))) {
    return -1;
}

ShowWindow(g_hwndMain, nCmdShow);
if (!UpdateWindow(g_hwndMain))
{
  DWORD dwErr = GetLastError();
  // handle UpdateWindow error here...
}

First Play Domain

Once you have created an application window, you can use the IDVDUserOperation::TitlePlay method to begin playing back the first play domain by passing 0 for the byteTitleNumber argument.

//start playback
pAnnexJ->TitlePlay(0);
if (FAILED(hres))
{
  // handle error here...
}

For more information about the variable pAnnexJ, see Fundamental DVD-Video API Interfaces.

See Also

Creating a Simple DVD Player

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.