IMDSPObject::Open

banner art

The Open method opens the associated object and prepares it for Read or Write operations. This operation is valid only if the storage object represents a file.

Syntax

HRESULT Open(UINTfuMode);

Parameters

fuMode

[in]  Mode in which the file must be opened. It must be one of the following two values.

Value Description
MDSP_READ Query whether a subsequent call to Read would be allowed.
MDSP_WRITE Query whether a subsequent call to Insert would be allowed.

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_BUSY The media device is busy.
ERROR_TOO_MANY_OPEN_FILES Cannot open any more files.
WMDM_E_INTERFACEDEAD The file or folder was previously deleted.
E_INVALIDARG The fuMode parameter is an invalid or NULL pointer.
E_FAIL An unspecified error occurred.

Remarks

If the underlying file-system does not support opening of multiple files at the same time, the service provider should gracefully the return Win32 error code ERROR_TOO_MANY_OPEN_FILES, if the client attempts to open more than one file at a time.

This method must be implemented. It must not return WMDM_E_NOTSUPPORTED or E_NOTIMPL. For more information, see Mandatory and Optional Interfaces.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also