IAMCopyCaptureFileProgress interface (strmif.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

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.

Inheritance

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

Methods

The IAMCopyCaptureFileProgress interface has these methods.

 
IAMCopyCaptureFileProgress::Progress

The Progress method is called periodically by the ICaptureGraphBuilder2::CopyCaptureFile method while it copies the file.

Remarks

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:

C++
class CProgress : public IAMCopyCaptureFileProgress 
{
public:
    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);
        }
        else
        {
            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:
C++
// Scope for CProgress object
{
    CProgress Prog;
    // Assume pBuilder is an initialized ICaptureGraphBuilder2 pointer.
    hr = pBuilder->CopyCaptureFile(szCaptureFile, szDestFile, TRUE,
        static_cast

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)

See also

Interfaces