_IWMEncoderEvents::OnIndexerStateChange

Windows Media Encoder SDK banner art

The OnIndexerStateChange method receives an event notice indicating whether the indexing process for a Windows Media file has been started or stopped.

Syntax

HRESULT OnIndexerStateChange(
  WMENC_INDEXER_STATE  enumIndexerState,
  BSTR  bstrFile
);

Parameters

enumIndexerState

[in]  Member of a WMENC_INDEXER_STATE enumeration type that indicates the state of the indexing process.

bstrFile

[in]  BSTR containing the name of the file being indexed.

Return Values

If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.

Remarks

A file index enables operations, such as fast forwarding, that must seek to specific time offsets in a file.

The index is added during the encoding process, and is no longer a postprocess. This event is provided for backward-compatibility.

Example Code

// Define the entry in the event sink map for this event.
BEGIN_SINK_MAP( CCallBack )
    SINK_ENTRY_EX( EVENT_ID, 
                   DIID__IWMEncoderEvents,
                   DISPID_ENCODEREVENT_INDEXERSTATECHANGE,
                   OnIndexerStateChange )
END_SINK_MAP()

// Implement the event handler for the event.
STDMETHOD( OnIndexerStateChange )( WMENC_INDEXER_STATE enumIndexerState,
                                   BSTR bstrFile )
{
    // TODO: Handle the event.
    return S_OK;
}

// Provide parameter information on the event handler.
HRESULT GetFuncInfoFromId( const IID& iid, DISPID dispidMember,
                           LCID lcid, _ATL_FUNC_INFO& info )
{
    if( InlineIsEqualGUID( iid, DIID__IWMEncoderEvents ) )
    {
        info.cc = CC_STDCALL;
        info.vtReturn = VT_ERROR;
        switch( dispidMember )
        {
        // Describe the parameters of the
        // event handler.
        case DISPID_ENCODEREVENT_INDEXERSTATECHANGE:
            info.nParams = 2;
            info.pVarTypes[0] = VT_I4;
            info.pVarTypes[1] = VT_BSTR;
            return S_OK;
            
        default:
            return E_FAIL;
        }
    }
    return E_FAIL;
}

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also