PSCreateMemoryPropertyStore function (propsys.h)
Creates an in-memory property store.
Syntax
PSSTDAPI PSCreateMemoryPropertyStore(
[in] REFIID riid,
[out] void **ppv
);
Parameters
[in] riid
Type: REFIID
Reference to the requested interface ID.
[out] ppv
Type: void**
When this function returns, contains a pointer to the desired interface, typically IPropertyStore or IPersistSerializedPropStorage.
Return value
Type: HRESULT
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
This function creates an in-memory property store object that implements IPropertyStore, INamedPropertyStore, IPropertyStoreCache, IPersistStream, IPropertyBag, and IPersistSerializedPropStorage.
This is the same object identified by InMemoryPropertyStore
(CLSID_InMemoryPropertyStore
) and InMemoryPropertyStoreMarshalByValue
(CLSID_InMemoryPropertyStoreMarshalByValue
), constructed with CoCreateInstance.
InMemoryPropertyStoreMarshalByValue
can be used in designs that pass objects
between processes to make them more efficient. It implements marshal by value, creating a copy of the object in the
unmarshal context and avoids inter-process communication that can be expensive.
The memory property store has no presistent representation so calls to IPropertyStore::Commit are a no-op.
The memory property store is thread safe and agile.
Examples
The following example demonstrates how to use InMemoryPropertyStore
.
auto memPropStore = wil::CoCreateInstance<InMemoryPropertyStore, IPropertyStore>();
auto value = PROPVARIANT{};
value.vt = VT_LPWSTR;
value.pwszVal = L"Title";
THROW_IF_FAILED(memPropStore->SetValue(PKEY_Title, value));
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP with SP2, Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 with SP1 [desktop apps only] |
Target Platform | Windows |
Header | propsys.h |
Library | Propsys.lib |
DLL | Propsys.dll (version 6.0 or later) |
Redistributable | Windows Desktop Search (WDS) 3.0 |