ate the reset condition=pMC- gt; Pause ();
}
}
//ЯOpenClip (int clip)
{hr;
//Reset status variables_psCurrent=Stopped; _lVolume=VOLUME_FULL; (MAX_PATH, g_szFileName); file; (clip)
{1:file=_tcscat(g_szFileName,_T(laquo;clip1.aviraquo;));break;2:file=_tcscat(g_szFileName,_T(laquo;clip2.aviraquo;));break;3:file=_tcscat(g_szFileName,_T(laquo;clip3.aviraquo;));break;4:file=_tcscat(g_szFileName,_T(laquo;clip4.aviraquo;));break;
}
//Start playing the media file=PlayMovieInWindow (file);
//If we could not play the clip, clean up (FAILED (hr)) ();
} CloseClip ()
{hr;
//Stop media playback (pMC)=pMC- gt; Stop ();
//Clear global flags_psCurrent=Stopped; _bAudioOnly=TRUE; _bFullscreen=FALSE;
//Free DirectShow interfaces ();
//Clear file name to allow selection of new file with open dialog_szFileName [0]=L 0 raquo ;;
//No current media state_psCurrent=Init;
//Reset the player windowrect; (ghApp, amp; rect); (ghApp, amp; rect, TRUE); ();
} CloseInterfaces (void)
{hr;
//Relinquish ownership (IMPORTANT!) after hiding video window (pVW)
{= pVW- gt; put_Visible (OAFALSE);=pVW- gt; put_Owner (NULL);
}
//Disable event callbacks (pME)=pME- gt; SetNotifyWindow ((OAHWND) NULL, 0, 0);
//Release and zero DirectShow interfaces_RELEASE(pME);_RELEASE(pMS);_RELEASE(pMP);_RELEASE(pMC);_RELEASE(pBA);_RELEASE(pBV);_RELEASE(pVW);_RELEASE(pGB);
}
//ЯMsg (TCHAR * szFormat, ...)
{szBuffer [1024];// Large buffer for long filenames or URLssize_t NUMCHARS=sizeof (szBuffer)/sizeof (szBuffer [0]); int LASTCHAR=NUMCHARS - 1;
//Format the input string_list pArgs; _start (pArgs, szFormat);
//Use a bounded buffer size to prevent buffer overruns. Limit count to
//character size minus one to allow for a NULL terminating character.
_ vsntprintf (szBuffer, NUMCHARS - 1, szFormat, pArgs); _ end (pArgs);
//Ensure that the formatted string is NULL-terminated [LASTCHAR]=TEXT ( 0 );
//Display a message box with the formatted string (NULL, szBuffer, TEXT ( PlayWnd Sample ), MB_OK);
}
//ЯToggleMute (void)
{hr=S_OK; ((! pGB) || (! pBA)) S_OK;
//Read current volume=pBA- gt; get_Volume ( amp; g_lVolume); (hr == E_NOTIMPL)
{
//Fail quietly if this is a video-only media fileS_OK;
} if (FAILED (hr))
{(TEXT ( Failed to read audio volume! hr=0x% x r n ), hr); hr;
}
//Switch volume levels (g_lVolume == VOLUME_FULL) _lVolume=VOLUME_SILENCE; _lVolume=VOLUME_FULL;
//Set new volume (pBA- gt; put_Volume (g_lVolume));
//UpdateMainTitle (); hr;
} ToggleFullScreen (void)
{hr=S_OK; lMode; HWND hDrain=0;
//Do not bother with full-screen for audio-only files ((g_bAudioOnly) || (! pVW)) S_OK;
//Read current state (pVW- gt; get_FullScreenMode ( amp; lMode)); (lMode == OAFALSE)
{
//Save current message drain (pVW- gt; get_MessageDrain ((OAHWND *) amp; hDrain));
//Set message drain to application main window (pVW- gt; put_MessageDrain ((OAHWND) ghApp));
//Switch to full-screen mode=OATRUE; (pVW- gt; put_FullScreenMode (lMode)); _ bFullscreen=TRUE;
}
{
//Switch back to windowed mode=OAFALSE; (pVW- gt; put_FullScreenMode (lMode));
//Undo change of message drain (pVW- gt; put_MessageDrain ((OAHWND) hDrain));
//Reset video window (pVW- gt; SetWindowForeground (- 1));
//Reclaim keyboard focus for player application (ghApp); (ghApp); (ghApp); _ bFullscreen=FALSE;
} hr;
}
//ЯHandleGraphEvent (void)
{evCode, evParam1, evParam2; hr=S_OK;
//Make sure that we do not access the med...