IWMDMStorageControl::Delete
The Delete method permanently deletes this storage.
Syntax
HRESULT Delete(UINTfuMode,IWMDMProgress* pProgress);
Parameters
fuMode
[in] One or two of the following flags, combined with a bitwise OR. Specify exactly one of the first two modes; the third mode is optional.
Mode | Description |
WMDM_MODE_BLOCK | The operation is performed using block mode (synchronous) processing. The call will not return until the operation is finished. |
WMDM_MODE_THREAD | The operation is performed using thread mode (asynchronous) processing. The call will return immediately, and the operation is 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] Optional pointer to an IWMDMProgress interface to be used by Windows Media Device Manager to report progress back to the application.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager 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 an extenstive 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 the WMDM_MODE_THREAD flag is specified, you should obtain completion status by calling either IWMDMProgress2::End2 or IWMDMProgress3::End3. These methods will ensure that the operation is complete and will also return an HRESULT with success or failure information.
When the Delete operation is finished, all references to the deleted object become invalid. The application must release these interfaces and any other interfaces or resources associated with the object.
If an application uses WMDM_MODE_THREAD and passes a non-null pProgress parameter, the application must ensure 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 an End notification. Failure to do this will result in access violations.
Requirements
Header: Defined in mswmdm.h.
Library: mssachlp.lib
See Also