PSCreateAdapterFromPropertyStore function

Creates an adapter from an IPropertyStore.

Syntax


HRESULT PSCreateAdapterFromPropertyStore(
  _In_   IPropertyStore *pps,
  _In_   REFIID riid,
  _Out_  void **ppv
);

Parameters

pps [in]

Type: IPropertyStore*

Pointer to an IPropertyStore object that represents the property store.

riid [in]

Type: REFIID

Reference to an IID.

ppv [out]

Type: void**

When this function returns, contains the interface pointer requested in riid.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The adapter object implements IPropertySetStorage, IPropertyStore, IPropertyStoreCapabilities, and IObjectProvider.

Use this function if you need an object that implements IPropertyStore with an API that requires an IPropertySetStorage interface. The object created can also be useful to a namespace extension that wants to provide support for binding to namespace items using IPropertySetStorage. Applications must call this object from only one thread at a time.

The adapter property store created by this function retains a reference to the source IPropertyStore interface. Therefore, the calling application is free to release its reference to the source IPropertyStore whenever convenient after calling this function.

The adapter property store makes calls to methods on the IPropertyStore interface as appropriate. Therefore, if the calling application is writing values to the store, it should call the IPropertyStore::Commit method on only one of the interfaces.

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSCreateAdapterFromPropertyStore to use an adapter property store to convert an IPropertyStore interface into an IPropertySetStorage interface.


// IPropertyStore *ppropstore;
// Assume variable ppropstore is initialized and valid
IPropertySetStorage *pSetStorage;

HRESULT hr = PSCreateadapterFromPropertyStore(ppropstore, IID_PPV_ARGS(&pSetStorage));

if (SUCCEEDED(hr))
{
    // pSetStorage is now valid and can be used to access the data in ppropstore.
    pSetStorage->Release();
}

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propsys.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

IPropertyStore
IPropertySetStorage
PSCreatePropertyStoreFromPropertySetStorage

 

 

Community Additions

ADD
Show:
© 2014 Microsoft