Handling Repaint Events in Video Capture (Windows CE 5.0)

Send Feedback

Applies to: Devices based on Windows Mobile Version 5.0 and later

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

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 ICaptureGraphBuilder2 interface, because the Capture Graph Builder does it for you automatically.

See Also

Advanced Capture Topics | Event Notification in DirectShow

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.