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.


HRESULT BeginWrite();

Return value

The application should return one of the following HRESULT values.

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


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


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;


Target Platform Windows
Header mswmdm.h
Library Mssachlp.lib

See also

Handling File Transfers Manually

IWMDMOperation Interface