Persistence
Persistence is achieved by implementing IPersistStorage, IPersistStream, or IPersistFile. These all derive from IPersist.
Windows is file-based, so the most common of these is IPersistFile. Typical API usage is asymmetric. Call IPersistFile::Save to save the object, but to load an object, most often you’d use CoGetInstanceFromFile. This in turn will call IPersistFile::Load. It returns an array of MULTI_QI objects.
Internally, CoGetInstanceFromFile calls GetClassFile to look up the CLSID from the file name.
References
- IPersist (objidl.h) - Win32 apps | Microsoft Learn
- IPersistStream (objidl.h) - Win32 apps | Microsoft Learn
- IPersistStreamInit (ocidl.h) - Win32 apps | Microsoft Learn
- IPersistMemory interface (Internet Explorer) | Microsoft Learn
- IPersistStorage (objidl.h) - Win32 apps | Microsoft Learn
- IPersistFile (objidl.h) - Win32 apps | Microsoft Learn
- IPersistPropertyBag - Win32 apps | Microsoft Learn
- IPersistMoniker interface (Windows) | Microsoft Learn
- IPersistHistory interface (Internet Explorer) | Microsoft Learn
- CreateStreamOnHGlobal function (combaseapi.h) - Win32 apps | Microsoft Learn
- OleSaveToStream function (ole.h) - Win32 apps | Microsoft Learn
- OleLoadFromStream function (ole.h) - Win32 apps | Microsoft Learn
- CoGetInstanceFromFile function (objbase.h) - Win32 apps | Microsoft Learn
- CoGetObject function (objbase.h) - Win32 apps | Microsoft Learn
- MULTI_QI (objidl.h) - Win32 apps | Microsoft Learn
- ISequentialStream (objidl.h) - Win32 apps | Microsoft Learn
- IStream (objidl.h) - Win32 apps | Microsoft Learn
- IStorage (objidl.h) - Win32 apps | Microsoft Learn
- IPropertySetStorage (propidl.h) - Win32 apps | Microsoft Learn
- IPropertyStorage (propidl.h) - Win32 apps | Microsoft Learn