Microsoft DirectShow 9.0


The CopyCaptureFile method copies the valid media data from a capture file.


  HRESULT CopyCaptureFile(
  LPOLESTR lpwstrOld,
  LPOLESTR lpwstrNew,
  int fAllowEscAbort,
  IAMCopyCaptureFileProgress *pCallback



[in] Pointer to a wide-character string that contains the source file name.


[in] Pointer to a wide-character string that contains the destination file name. Valid data is copied to this file.


[in] Boolean value that specifies whether pressing the ESC key cancels the copy operation. If the value is TRUE and the user presses the ESC key, the operation halts. If the value is FALSE, the method ignores the ESC key.


[in] Pointer to an IAMCopyCaptureFileProgress interface to display progress information, or NULL. See Remarks for more information.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
S_FALSE User canceled the operation before it completed.
S_OK Success.
E_FAIL Failure.
E_INVALIDARG Could not open the source file or destination file.
E_OUTOFMEMORY Insufficient memory.
E_POINTER NULL pointer argument.


Typically, you will first capture to a large preallocated file. This method copies just the valid data to a new file. As a result, the new file can be much smaller than the original file.

The source and destination files must be AVI files. Other file types are not supported.

To display the progress of the copy operation, implement the IAMCopyCaptureFileProgress interface and pass a pointer to the interface in the pCallback parameter. If pCallback is non-NULL, this method periodically calls the IAMCopyCaptureFileProgress::Progress method with an integer between 0 and 100 that specifies the percentage complete.


Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also