다음을 통해 공유


PSCreateDelayedMultiplexPropertyStore 함수(propsys.h)

여러 속성 저장소를 포함하는 읽기 전용 지연 바인딩 속성 저장소를 만듭니다.

구문

PSSTDAPI PSCreateDelayedMultiplexPropertyStore(
        GETPROPERTYSTOREFLAGS        flags,
        IDelayedPropertyStoreFactory *pdpsf,
  [in]  const DWORD                  *rgStoreIds,
  [in]  DWORD                        cStores,
  [in]  REFIID                       riid,
  [out] void                         **ppv
);

매개 변수

flags

형식: GETPROPERTYSTOREFLAGS

하나 이상의 GETPROPERTYSTOREFLAGS 값입니다. 이러한 값은 만든 속성 저장소 개체의 세부 정보를 지정합니다.

pdpsf

형식: IDelayedPropertyStoreFactory*

IDelayedPropertyStoreFactory의 instance 대한 인터페이스 포인터입니다.

[in] rgStoreIds

형식: const DWORD*

속성 저장소 ID의 배열에 대한 포인터입니다. 이 배열을 초기화할 필요가 없습니다.

[in] cStores

형식:DWORD

rgStoreIds가 가리키는 배열의 요소 수입니다.

[in] riid

형식: REFIID

생성된 속성 저장소를 나타내는 인터페이스의 요청된 IID에 대한 참조입니다.

[out] ppv

형식: void**

이 함수가 반환되면 는 riid에서 요청된 인터페이스 포인터를 포함합니다. 일반적으로 IPropertyStore입니다.

반환 값

형식: HRESULT

이 함수가 성공하면 S_OK 반환합니다. 그러지 않으면 HRESULT 오류 코드를 반환합니다.

설명

이 함수는 IPropertyStore,INamedPropertyStore, IObjectProviderIPropertyStoreCapabilities를 구현하는 COM(Component Object Model) 개체를 만듭니다.

애플리케이션은 한 번에 하나의 스레드에서만 이 개체를 호출해야 합니다.

PSCreateDelayedMultiplexPropertyStore를 호출하기 전에 CoInitialize 또는 OleInitialize를 사용하여 COM을 초기화해야 합니다. COM은 이 개체의 수명 동안 초기화된 상태를 유지해야 합니다.

PSCreateDelayedMultiplexPropertyStorePSCreateMultiplexPropertyStore 대신 설계되었으며, 이를 위해서는 속성 저장소의 배열이 멀티플렉스 속성 저장소를 만들기 전에 초기화되어야 합니다.

지연된 바인딩 메커니즘은 멀티플렉스 속성 저장소에서 IPropertyStore::GetValue 호출에 대한 성능 향상으로 설계되었습니다. 속성 값을 묻는 메시지가 표시되면 지연된 멀티플렉스 속성 저장소는 각 속성 저장소에서 값을 확인합니다. 값을 찾은 후에는 후속 저장소를 만들고 초기화할 필요가 없습니다. 지연된 멀티플렉스 속성 저장소는 속성 저장소 중 하나가 성공 코드와 VT_EMPTY 아닌 값을 반환할 때 값 검색을 중지합니다.

지연된 멀티플렉스 속성 저장소가 특정 속성 저장소에 액세스해야 하는 경우 먼저 해당 속성 저장소에 대한 인터페이스를 이미 얻었는지 확인합니다. 그렇지 않은 경우 적절한 속성 저장소 ID를 사용하여 IDelayedPropertyStoreFactory::GetDelayedPropertyStore 를 호출하여 속성 저장소를 가져옵니다. 항상 애플리케이션에서 제공하는 순서대로 속성 저장소 ID를 사용합니다. 모든 ID가 사용되지는 않을 수 있습니다.

IDelayedPropertyStoreFactory 호출이 특정 속성 저장소 ID에 대한 E_NOTIMPL 또는 E_ACCESSDENIED 실패하거나 애플리케이션이 GPS_BESTEFFORT 지정한 경우 오류가 무시되고 지연된 멀티플렉스 속성 저장소가 다음 속성 저장소로 이동합니다.

경우에 따라 PSCreateMultiplexPropertyStore 대신 PSCreateDelayedMultiplexPropertyStore를 사용하는 것이 도움이 될 수 있습니다. 예를 들어 애플리케이션이 두 개의 속성 저장소를 멀티플렉싱해야 하는 경우 첫 번째 속성 저장소는 메모리를 많이 사용하지 않고 PKEY_Size 정보를 제공합니다. 종종 호출 애플리케이션은 멀티플렉스 속성 저장소를 요청한 다음 개체를 해제하기 전에 PKEY_Size 요청합니다. 이러한 경우 애플리케이션은 PSCreateDelayedMultiplexPropertyStore 를 호출하고 IDelayedPropertyStoreFactory를 구현하여 두 번째 속성 저장소를 초기화하는 비용을 방지할 수 있습니다.

예제

더 큰 프로그램의 일부로 포함할 다음 예제에서는 IPropertyStoreFactory::GetPropertyStore 구현에서 PSCreateDelayedMultiplexPropertyStore를 사용하는 방법을 보여 줍니다.

// CMyFactory is a reference-counted COM object that implements both IPropertyStoreFactory and IDelayedPropertyStoreFactory.

// CMyFactory is assumed to be fully implemented, but for the sake of brevity, 
// many functions are not shown here. 

// Private functions are indicated with an underscore prefix.

// The hope is that the fastest property store satisfies the caller's queries 
// so that the slower property stores are never created.
 
// CMyFactory implementation for IPropertyStoreFactory::GetPropertyStore
HRESULT CMyFactory::GetPropertyStore( __in GETPROPERTYSTOREFLAGS flags,
                                      __in_opt IUnknown *pUnkFactory,
                                      __in REFIID riid,
                                      __deref_out void **ppv)
{
    *ppv = NULL;
    HRESULT hr;
 
    // This application creates only read-only stores.
    if (flags & GPS_READWRITE)
    {
        hr = STG_E_ACCESSDENIED;
    }
    else
    {
        // More advanced applications would check other GETPROPERTYSTOREFLAGS 
        // flags and respond appropriately.
 
        // This application always creates its stores in-process, so it 
        // ignores the pUnkFactory value.
        
        DWORD rgStoreIds[] = {0, 1, 2};
        
        hr = PSCreateDelayedMultiplexPropertyStore(flags, this, rgStoreIds, ARRAYSIZE(rgStoreIds), riid, ppv);
    }
 
    return hr;
}
 
// CMyFactory implementation of IDelayedPropertyStoreFactory::GetDelayedPropertyStore
HRESULT CMyFactory::GetDelayedPropertyStore(GETPROPERTYSTOREFLAGS flags,
                                            DWORD dwStoreId,
                                            REFIID riid,
                                            void **ppv)
{
    *ppv = NULL;
    HRESULT hr;
    
    // Note: The IDs here match the IDs in rgStoreIds above.

    if (dwStoreId == 0)
    {
        // This store is the fastest at returning properties.

        hr = _CreateFastestPropertyStore(flags, riid, ppv);
    }
    else if (dwStoreId == 1)
    {
        // This store is slower at returning properties.
        hr = _CreateSlowerPropertyStore(flags, riid, ppv);
    }
    else if (dwStoreId == 2)
    {
        // This store is very slow at returning properties.
        hr = _CreateSlowestPropertyStore(flags, riid, ppv);
    }
    else
    {
        // This should never happen.
        hr = E_UNEXPECTED;
    }
    
    return hr;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 WINDOWS XP SP2, Windows Vista [데스크톱 앱만 해당]
지원되는 최소 서버 WINDOWS Server 2003 SP1 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 propsys.h
라이브러리 Propsys.lib
DLL Propsys.dll(버전 6.0 이상)
재배포 가능 파일 WDS(Windows 데스크톱 검색) 3.0

추가 정보

IPropertyStoreFactory

PSCreateMultiplexPropertyStore