Reputation:
I've successfully obtained an IPropertyBag
for the view state of a folder. I obtained it using SHGetViewStatePropertyBag
, and I've confirmed that the bag is valid by checking some property values.
What I'd like to do now is persist the property bag to disk as a blob, if possible. I've been running QueryInterface
on the bag, and I haven't been able to obtain any helpful interfaces. Unfortunately, it appears that the property bag doesn't support an IPersistStream
interface. And I haven't been able to successfully query the IPersistPropertyBag
interface either.
Is there a trick to getting some sort of persist interface for a property bag? Or do the properties essentially have to be saved individually, in an ad hoc manner? Thanks in advance for any guidance.
Upvotes: 1
Views: 209
Reputation: 61378
Calling Write
on the IPropertyBag
should write the change to disk automagically.
In general, IPersistXXX interface is implemented by objects that can save themselves into an XXX (where XXX is either Stream or PropertyBag), meanwhile IPropertyBag
and IStream
are expected to be backed by something - a disk, or a memory block, or a socket.
Or do want to take all properties from the bag and somehow save them elsewhere? In that case, you'd want to query for IPropertyBag2
and enumerate them.
Upvotes: 0