To Implement Reader Messages in 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.]
To use the asynchronous reader to deliver content from an ASF file, you must implement a minimum of two callback methods, IWMStatusCallback::OnStatus and IWMReaderCallback::OnSample. This section describes how to implement IWMStatusCallback::OnStatus to receive and respond to status messages sent by the reader. OnStatus is used by other objects in the Windows Media Format SDK. For general information about OnStatus, see Using the OnStatus Callback.
When using the asynchronous reader, you must trap the following messages in IWMStatusCallback::OnStatus.
Status message | Description |
---|---|
WMT_OPENED | Sent when file opening operations are complete. |
WMT_CLOSED | Sent when file closing operations are complete. |
You should use the status messages listed above to control execution of your reading application. For example, you must wait until receiving the WMT_OPENED message to start the reader or call other methods that require the reader to have a file ready. Frequently, applications built with the asynchronous reader use an event to signal the completion of asynchronous calls and proceed with processing. For more information about using events for signaling completion of operations, see Using Events with Asynchronous Calls.
Many other messages are sent to OnStatus by the reader object to enable the application to respond to the status of reading operations. The possible status message values are defined in the WMT_STATUS enumeration type.
Related topics