Redigera

Dela via


Using the OnStatus Callback

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The IWMStatusCallback::OnStatus callback method is called by several objects in the Windows Media Format SDK. OnStatus receives messages that represent changes in the status of SDK operations.

To use the OnStatus callback method, you must implement a class in your application that inherits from the IWMStatusCallback interface. Include code for your version of OnStatus in the class. Several examples of OnStatus implementations can be found in the samples included with this SDK. For more information about the samples, see Sample Applications.

You must associate your implementation of the status callback with various objects of the Windows Media Format SDK. Each object has a different way of making this association. For a list of the methods that associate specific objects, see the IWMStatusCallback reference page.

The status messages that can be received by OnStatus are defined in the WMT_STATUS enumeration type.

You can choose which messages to trap and which to ignore. However, responding to some status messages is required for certain features. For example, when using the asynchronous reader, the IWMReader::Open method opens a file asynchronously. The only way to tell when the file has been opened is to trap the MWT_OPENED message. Typically, the messages you respond to are notifications of the completion of asynchronous tasks.

Using the Callback Methods