IWMDMStorageControl::Delete
The Delete method permanently removes specified content from a storage medium.
Syntax
HRESULT Delete(
UINT fuMode,
IWMDMProgress* pProgress
);
Parameters
fuMode
[in] Specifies whether the Delete operation is to be carried out in block or thread mode, and whether it should be recursive if the storage object is a folder. The following table lists the mode values that can be passed in this parameter. Specify exactly one of the first two modes; if both are specified, block mode is used. The third mode can be specified or not, independent of the first two.
Mode | Description |
WMDM_MODE_BLOCK | The operation will be performed using block mode processing. The call will not return until the operation is finished. |
WMDM_MODE_THREAD | The operation will be performed using thread mode processing. The call will return immediately, and the operation will be performed in a background thread. |
WMDM_MODE_RECURSIVE | If the storage object is a folder, it and its contents, and all subfolders and their contents are deleted. |
pProgress
[in] Pointer to an IWMDMProgress interface to be used by Windows Media Device Manager to report progress back to the application. The pProgress argument can be NULL.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:
- Standard COM error codes
- Windows error codes converted to HRESULT values
- Windows Media Device Manager error codes
For a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table.
Return code | Description |
S_OK | The method succeeded. |
WMDM_E_INTERFACEDEAD | The file or folder was previously deleted. |
E_BUSY | The media device is already busy with another operation. |
E_INVALIDARG | A parameter is invalid or is a NULL pointer. |
E_FAIL | An unspecified error occurred. |
WMDM_E_NOTCERTIFIED | The caller is not certified. |
Remarks
If WMDM_MODE_BLOCK is specified, the Delete method does not return until the deletion is finished. If the WMDM_MODE_THREAD is specified, the call returns immediately, and the caller can use the IWMDMStorageGlobals::GetStatus function to track the Delete operation.To ensure that the file operation is finished, call IWMDMDevice::GetStatus and check for WMDM_STATUS_READY.
When the Delete operation is finished, the IWMDMStorage and IWMDMStorageControl interfaces, as well as any other interfaces derived from the IWMDMStorage interface that represented the object, are no longer valid. The application must release these interfaces and any other interfaces or resources associated with the object (content).
While using WMDM_MODE_THREAD, applications must make sure that the object to which pProgress belongs is not destroyed until the delete operation completes, because Windows Media Device Manager will send progress notifications to this object. This object can be destroyed only after it receives End notification. Failure to do this will result in access violations.
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also