c++oleistorage

How to save a storage (IStorage) object to a file (С++)?


I have got a storage, created from MS Outlook letter dragged to my window. How can I save it's (storage) contents as a file in a single file ?

I have read MSDN about manipulations with storages - StgCreateDocfile creates (if I am right) a new storage, but I need to save an existing one.


Solution

    1. StgCreateDocfile(..., &new_storage); creates an empty or opens an existing file storage.
    2. existing_storage->CopyTo(0, nullptr, nullptr, new_storage) copies an existing storage to a file storage.