Microsoft DirectX 8.1 (C++)

Repaint Events

If the user covers and uncovers the preview window, the video renderer receives a WM_PAINT message. By default, the video renderer requests a new frame so that it can repaint the window. If this occurs during file capture, it will corrupt your capture file and make it unusable. Therefore, if your capture graph writes data to a file, you must cancel the default handling for repaint events. Query the filter graph manager for the IMediaEvent interface, and call the IMediaEvent::CancelDefaultHandling method with the EC_REPAINT event code as the parameter.

For more information, see Event Notification in DirectShow.