IWMDMOperation::BeginWrite method (mswmdm.h)

The BeginWrite method indicates that a "write to device" action is beginning. Windows Media Device Manager only calls this method if the application calls IWMDMStorageControl/2/3::Insert/2/3 and passes in this interface.

Syntax

HRESULT BeginWrite();

Return value

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.

Remarks

This method is called just before the Windows Media Device Manager calls IWMDMOperation::TransferObjectData to begin writing data to the device.

Examples

The following C++ code example implements the BeginWrite method and outputs a message when a write-to-device action is beginning.


HRESULT BeginWrite()
{
    // TODO: Display the message: "IWMDMOperation event--BeginWrite."
    
    // If the global handle of the destination 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_WRITE;
    return S_OK;
}

Requirements

Requirement Value
Target Platform Windows
Header mswmdm.h
Library Mssachlp.lib

See also

Handling File Transfers Manually

IWMDMOperation Interface

IWMDMOperation::BeginRead