Compartilhar via


IWMDMOperation::BeginRead

banner art

The BeginRead method indicates that a "read from device" action is beginning. Windows Media Device Manager only calls this method if the application calls IWMDMStorageControl::Read and passes in this IWMDMOperation interface.

Syntax

HRESULT BeginRead();

Parameters

This method takes no parameters.

Return Values

The application should return one of the following HRESULT values.

Return code Description
S_OK The read operation should continue.
WMDM_E_USER_CANCELLED The read operation should be cancelled without finishing.
E_FAIL An unspecified error occurred, and the read operation should be cancelled without finishing.

If the application returns either E_FAIL or WMDM_E_USER_CANCELLED, the Windows Media Device Manager will call the End method to indicate that the process has been terminated. If the application is using block mode and returns WMDM_E_USER_CANCELLED, then Windows Media Device Manager will return that error to the application.

Remarks

This method is called just before the Windows Media Device Manager calls IWMDMOperation::TransferObjectData.

Example Code

The following C++ code example implements the BeginRead method and outputs a message when a read-from-device action is beginning.

HRESULT BeginRead()
{
    // TODO: Display the message: "IWMDMOperation event--BeginRead."

    // If the global handle of the source file is uninitialized, fail.
    if (m_File == INVALID_HANDLE_VALUE)
        return E_FAIL;

    // Global status to let TransferObjectData know what kind of
    // operation is happening.
    m_OperationStatus = OPERATION_READ;
    return S_OK;
}

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also