IAMCopyCaptureFileProgress interface

The IAMCopyCaptureFileProgress interface is a callback interface used by the ICaptureGraphBuilder2::CopyCaptureFile method.

Because the CopyCaptureFile method can take a long time to complete, an application can implement this interface to receive periodic notifications about the progress of the copy operation. If the application does not need to receive this information, there is no need to implement the interface.


The IAMCopyCaptureFileProgress interface inherits from the IUnknown interface. IAMCopyCaptureFileProgress also has these types of members:


The IAMCopyCaptureFileProgress interface has these methods.


Called periodically by the ICaptureGraphBuilder2::CopyCaptureFile method during capture operations.



To use this interface, implement a class that inherits the interface and implements all of its methods, including the methods in IUnknown. In your application, create an instance of the class and pass it to the CopyCaptureFile method. You do not have to implement COM reference counting in your class, as long as the object is guaranteed not to be deleted before the CopyCaptureFile method returns.

The following example shows a class that implements the interface:

class CProgress : public IAMCopyCaptureFileProgress 
    STDMETHODIMP_(ULONG) AddRef() { return 1; }
    STDMETHODIMP_(ULONG) Release() { return 0; }
    STDMETHODIMP QueryInterface(REFIID iid, void **ppv) 
        if  (ppv == NULL) 
            return E_POINTER;
        else if (iid == __uuidof(IUnknown))
            *ppv = static_cast<IUnknown*>(this);
        else if (iid == IID_IAMCopyCaptureFileProgress) 
            *ppv = static_cast<IAMCopyCaptureFileProgress*>(this);
            return E_NOINTERFACE;
        return S_OK;
    STDMETHODIMP Progress(int iPercent) 
        if (iPercent < 0 || iPercent > 100) 
            return E_INVALIDARG;

        TCHAR szMsg[32];
        StringCchPrintf(szMsg, 32, TEXT("Progress: %d%%"), iPercent);
        // Assume g_hwndStatus is a valid HWND.
        SetWindowText(g_hwndStatus, szMsg);  

        return S_OK;

The following example uses this class in the CopyCaptureFile method:

// Scope for CProgress object
    CProgress Prog;
    // Assume pBuilder is an initialized ICaptureGraphBuilder2 pointer.
    hr = pBuilder->CopyCaptureFile(szCaptureFile, szDestFile, TRUE,


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Strmif.h (include Dshow.h)



See also