Providing a Private Device Context

You can improve playback performance slightly by providing a private device context for the Movie Player. To do this, use the mmpSetDC function, which has the following syntax:

BOOL mmpSetDC(idMovie, hDC)

The idMovie parameter identifies the Movie Player instance. The hDC parameter should contain a handle to a private device context for the stage window. If you pass a NULL value to this parameter, the Movie Player stops using the private device context and resumes calling GetDC and ReleaseDC with each operation.

To obtain a private device context for the stage window, you must specify the CS_OWNDC flag in the style field of the WNDCLASS structure for the window. For example, an application uses the following sequence to register the window class for the main stage window:

WNDCLASS wndclass;
    .
    .
    .
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = MainWndProc;
    .
    .
    .
wndclass.lpszClassName = szAppName;

if(!RegisterClass(&wndclass))
    return FALSE;

If you use this technique, be sure to use the CS_OWNDC flag when registering your stage window. Otherwise, you'll deprive other applications of one of five common device contexts. An application can use the following mmpSetDC function to provide the Movie Player with a handle to the private device context:

mmpSetDC(idMovie, GetDC(hWnd));