Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

If you build a video capture graph withoutusing the ICaptureGraphBuilder2 interface, and you preview the video using the old DirectShow Video Renderer filter, then you should override the default handling for EC_REPAINTevents. Query the Filter Graph Manager for the IMediaEvent Interfaceand call the IMediaEvent::CancelDefaultHandlingmethod with the value EC_REPAINT:

Copy Code
IMediaEvent *pEvent = 0;
hr = pGraph->QueryInterface(IID_IMediaEvent,
(void**)&pEvent);
if (SUCCEEDED(hr))
{
	pEvent->CancelDefaultHandling (EC_REPAINT);
	pEvent->Release();
}

This prevents a possible error that can corrupt your capture file. If the user covers and uncovers the preview window, the Video Renderer filter receives a WM_PAINT message. By default, the Video Renderer requests a new frame, and the Filter Graph Manager pauses the graph in order to cue another video frame. If that happens while the graph is writing a file, it will corrupt the file. Overriding the default EC_REPAINT behavior prevents the renderer from requesting a new frame.

You do not have to perform this step if you are using the ICaptureGraphBuilder2interface, because the Capture Graph Builder does it for you automatically.

See Also