IStorage::MoveElementTo method
The MoveElementTo method copies or moves a substorage or stream from this storage object to another storage object.
Syntax
HRESULT MoveElementTo( [in] const WCHAR *pwcsName, [in] IStorage *pstgDest, [in] LPWSTR pwcsNewName, [in] DWORD grfFlags );
Parameters
- pwcsName [in]
-
Pointer to a wide character null-terminated Unicode string that contains the name of the element in this storage object to be moved or copied.
- pstgDest [in]
-
IStorage pointer to the destination storage object.
- pwcsNewName [in]
-
Pointer to a wide character null-terminated unicode string that contains the new name for the element in its new storage object.
- grfFlags [in]
-
Specifies whether the operation should be a move (STGMOVE_MOVE) or a copy (STGMOVE_COPY). See the STGMOVE enumeration.
Return value
This method can return one of these values.
- S_OK
-
The storage object was successfully copied or moved.
- E_PENDING
-
Asynchronous Storage only: Part or all of the element's data is currently unavailable. For more information, see IFillLockBytes and Asynchronous Storage.
- STG_E_ACCESSDENIED
-
The destination storage object is a child of the source storage object. Or, the destination object and element name are the same as the source object and element name. In other words, you cannot move an element to itself.
- STG_E_FILENOTFOUND
-
The element with the specified name does not exist.
- STG_E_FILEALREADYEXISTS
-
The specified file already exists.
- STG_E_INSUFFICIENTMEMORY
-
The copy or move was not completed due to a lack of memory.
- STG_E_INVALIDFLAG
-
The value for the grfFlags parameter is not valid.
- STG_E_INVALIDNAME
-
Not a valid value for pwcsName.
- STG_E_INVALIDPOINTER
-
The pointer specified for the storage object was not valid.
- STG_E_INVALIDPARAMETER
-
One of the parameters was not valid.
- STG_E_REVERTED
-
The storage object has been invalidated by a revert operation above it in the transaction tree.
- STG_E_TOOMANYOPENFILES
-
The copy or move was not completed because there are too many open files.
Remarks
The IStorage::MoveElementTo method is typically the same as invoking the IStorage::CopyTo method on the indicated element and then removing the source element. In this case, the MoveElementTo method uses only the publicly available functions of the destination storage object to carry out the move.
If the source and destination storage objects have special knowledge about each other's implementation (they could, for example, be different instances of the same implementation), this method can be implemented more efficiently.
Before calling this method, the element to be moved must be closed, and the destination storage must be open. Also, the destination object and element cannot be the same storage object/element name as the source of the move. That is, you cannot move an element to itself.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Header |
|
|
IDL |
|
|
Library |
|
|
DLL |
|
|
IID |
IID_IStorage is defined as 0000000B-0000-0000-C000-000000000046 |
See also