Share via


IWMDMOperation::BeginWrite

banner art

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();

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, Windows Media Device Manager will call the End method to indicate that termination is finished. 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 to begin writing data to the device.

Example Code

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

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also