Initialize method

Called when the filter is activated by Windows Internet Explorer.

Syntax

HRESULT retVal = object.Initialize(pEventSink);

Parameters

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The IImageDecodeEventSink interfaces provides information about the drawing surface (canvas). As this instance pointer will be used in other methods, you should save it in a member variable.

Examples

The following example demonstrates the basic implementation of the IImageDecodeFilter::Initialize method. (Note that it is not necessary to call AddRef on the IImageDecodeEventSink pointer.)

STDMETHODIMP
CImageDecodeFilter::Initialize(IImageDecodeEventSink* pEventSink)
{
    HRESULT hr;

    if (pEventSink == NULL)
        return E_INVALIDARG;

    m_pEventSink = pEventSink;

    hr = pEventSink->OnBeginDecode(&m_dwEvents, &m_nFormats, &m_pFormats);

    return hr;
}

See also

IImageDecodeEventSink::OnBeginDecode