StgCreatePropSetStg 함수(coml2api.h)

StgCreatePropSetStg 함수는 지정된 스토리지 개체에서 속성 집합 스토리지 개체를 만듭니다. 속성 집합 스토리지 개체는 IPropertySetStorage 인터페이스의 시스템 제공 독립 실행형 구현을 제공합니다.

구문

HRESULT StgCreatePropSetStg(
  [in]  IStorage            *pStorage,
        DWORD               dwReserved,
  [out] IPropertySetStorage **ppPropSetStg
);

매개 변수

[in] pStorage

하나 이상의 속성 집합을 포함하거나 포함하는 스토리지 개체에 대한 포인터입니다.

dwReserved

나중에 사용하도록 예약되어 있습니다. 0이어야 합니다.

[out] ppPropSetStg

속성 집합 스토리지 개체에 대한 인터페이스 포인터를 수신하는 IPropertySetStorage* 포인터 변수에 대한 포인터입니다.

반환 값

이 함수는 E_INVALIDARG 표준 반환 값과 다음을 지원합니다.

설명

StgCreatePropSetStg 함수는 pStorage 매개 변수로 지정된 지정된 IStorage 인터페이스에서 작동하는 IPropertySetStorage 인터페이스를 만듭니다. 이 함수는 IPropertySetStorage 인터페이스에 대한 후속 호출이 있을 수 있지만 이 IStorage 자체를 수정하지는 않습니다.

StgCreatePropSetStgpStorage로 지정된 스토리지 개체에서 IUnknown::AddRef를 호출합니다. 호출자는 Release를 호출하여 더 이상 필요하지 않은 경우 개체를 해제해야 합니다.

예제

다음 예제 코드에서는 이 함수가 스토리지 개체 내에 속성 집합을 만드는 방법을 보여 줍니다.

IPropertyStorage*
CreatePropertySetInStorage( IStorage *pStg, const FMTID &fmtid )
{
    HRESULT hr = S_OK;
    IPropertySetStorage *pPropSetStg = NULL;
    IPropertyStorage *pPropStg = NULL;
 
    try
    {
        hr = StgCreatePropSetStg( pStg, 0, &pPropSetStg );
        if( FAILED(hr) ) throw L"Failed StgCreatePropSetStg (%08x)";
 
        hr = pPropSetStg->Create( fmtid, NULL,
            PROPSETFLAG_DEFAULT,
            STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
            &pPropStg );
        if( FAILED(hr) ) 
            throw L"Failed IPropertySetStorage::Create (%08x)";
 
        // Success. The caller must now call Release on both
        // pPropSetStg and pStg.
 
    }
    catch( const WCHAR *pwszError )
    {
        wprintf( L"Error: %s (%08x)\n", pwszError, hr );
    }
 
    if( NULL != pPropSetStg )
        pPropSetStg->Release();
 
    return( pPropStg );
}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 2000 Professional [데스크톱 앱 | UWP 앱]
지원되는 최소 서버 Windows 2000 Server [데스크톱 앱 | UWP 앱]
대상 플랫폼 Windows
헤더 coml2api.h(Propidl.h 포함)
라이브러리 Ole32.lib
DLL Ole32.dll

추가 정보

IPropertySetStorage-독립 실행형 구현

샘플

StgCreatePropSetStg 샘플