Pour désactiver l’indexation automatique

Il se peut que vous ne souhaitiez pas toujours qu’un index soit généré par défaut lors de l’écriture d’un fichier ASF. Vous pouvez désactiver l’indexation automatique à l’aide de la méthode IWMWriterFileSink3 :: SetAutoIndexing .

L’exemple de code suivant montre comment désactiver l’indexation automatique par le writer.

IWMWriterFileSink*  pBaseFileSink = NULL;
IWMWriterFileSink3* pMySink       = NULL;

BOOL    fAutoIndex;
HRESULT hr = S_OK;

// Initialize COM.
hr = CoInitialize(NULL);

// Create a writer file sink.
hr = WMCreateWriterFileSink(&pBaseFileSink);

// Retrieve an IWMWriterFileSink3 interface pointer for the new sink.
hr = pBaseFileSink->QueryInterface(IID_IWMWriterFileSink3,
                                    (void**)&pMySink);

// Release the base file sink.
pBaseFileSink->Release();
pBaseFileSink = NULL;

// Check the state of automatic indexing.
hr = pMySink->GetAutoIndexing(&fAutoIndex);

// If auto indexing is enabled, turn it off.
if(fAutoIndex)
   pMySink->SetAutoIndexing(FALSE);

// You can now write to this sink and the file will not have an index.

// Release the remaining interface.
pMySink->Release();
pMySink = NULL;

IWMWriterFileSink3::GetAutoIndexing

WMCreateWriterFileSink

Utilisation des index