次の方法で共有


ActivationFactory クラス

1 つ以上のクラスを Windows ランタイムによってアクティブ化できるようにします。

構文

template <
    typename I0 = Details::Nil,
    typename I1 = Details::Nil,
    typename I2 = Details::Nil
>
class ActivationFactory :
    public Details::RuntimeClass<
        typename Details::InterfaceListHelper<
            IActivationFactory,
            I0,
            I1,
            I2,
            Details::Nil
        >::TypeT,
        RuntimeClassFlags<WinRt | InhibitWeakReference>,
        false
    >;

パラメーター

I0
0 番目のインターフェイス。

I1
1 番目のインターフェイス。

I2
2 番目のインターフェイス。

解説

ActivationFactoryIActivationFactory インターフェイスの登録メソッドと基本機能を提供します。 ActivationFactory により、カスタム ファクトリ実装も提供できます。

次のコード片は、ActivationFactory の使用方法を象徴的に示しています。

struct MyClassFactory : public ActivationFactory<IMyAddtionalInterfaceOnFactory>
{
    STDMETHOD(ActivateInstance) (_Outptr_result_nullonfailure_ IInspectable** ppvObject)
    {
        // my custom implementation

        return S_OK;
    }
};

ActivatableClassWithFactory(MyClass, MyClassFactory);
// or if a default factory is used:
//ActivatableClassWithFactory(MyClass, SimpleActivationFactory);

次のコード片は、Implements 構造体を使って 4 つ以上のインターフェイス ID を指定する方法を示します。

struct MyFactory : ActivationFactory<Implements<I1, I2, I3>, I4, I5>;

メンバー

パブリック コンストラクター

名前 説明
ActivationFactory::ActivationFactory クラスを初期化します ActivationFactory

パブリック メソッド

名前 説明
ActivationFactory::AddRef 現在の ActivationFactory オブジェクトの参照カウントをインクリメントします。
ActivationFactory::GetIids 実装されたインターフェイス ID の配列を取得します。
ActivationFactory::GetRuntimeClassName 現在の ActivationFactory がインスタンス化するオブジェクトのランタイム クラス名を取得します。
ActivationFactory::GetTrustLevel 現在の ActivationFactory がインスタンス化するオブジェクトの信頼レベルを取得します。
ActivationFactory::QueryInterface 指定されたインターフェイスへのポインターを取得します。
ActivationFactory::Release 現在の ActivationFactory オブジェクトの参照カウントをデクリメントします。

継承階層

I0

ChainInterfaces

I0

RuntimeClassBase

ImplementsHelper

DontUseNewUseMake

RuntimeClassFlags

RuntimeClassBaseT

RuntimeClass

ActivationFactory

要件

ヘッダー: module.h

名前空間: Microsoft::WRL

ActivationFactory::ActivationFactory

クラスを初期化します ActivationFactory

ActivationFactory();

ActivationFactory::AddRef

現在の ActivationFactory オブジェクトの参照カウントをインクリメントします。

STDMETHOD_(
   ULONG,
   AddRef
)();

戻り値

成功した場合は S_OK、そうでない場合は失敗を示す HRESULT。

ActivationFactory::GetIids

実装されたインターフェイス ID の配列を取得します。

STDMETHOD(
   GetIids
)(_Out_ ULONG *iidCount, _Deref_out_ _Deref_post_cap_(*iidCount) IID **iids);

パラメーター

iidCount
この操作が完了すると、iids 配列内 のインターフェイス ID の 数。

iids
この操作が完了するときの、実装されているインターフェイス ID の配列。

戻り値

成功した場合は S_OK、そうでない場合は失敗を示す HRESULT。 E_OUTOFMEMORY は、HRESULT エラーが発生する可能性があります。

ActivationFactory::GetRuntimeClassName

現在の ActivationFactory がインスタンス化するオブジェクトのランタイム クラス名を取得します。

STDMETHOD(
   GetRuntimeClassName
)(_Out_ HSTRING* runtimeName);

パラメーター

runtimeName
この操作が完了するときの、現在の ActivationFactory がインスタンス化するオブジェクトのランタイム クラス名を含む文字列へのハンドル。

戻り値

成功した場合は S_OK、そうでない場合は失敗を示す HRESULT。

ActivationFactory::GetTrustLevel

現在の ActivationFactory がインスタンス化するオブジェクトの信頼レベルを取得します。

STDMETHOD(
   GetTrustLevel
)(_Out_ TrustLevel* trustLvl);

パラメーター

trustLvl
この操作が完了するときの、ActivationFactory がインスタンス化するランタイム クラスの信頼レベル。

戻り値

成功した場合は S_OK。それ以外の場合は、アサーション エラーが生成され、trustLvlFullTrust に設定されます。

ActivationFactory::QueryInterface

指定されたインターフェイスへのポインターを取得します。

STDMETHOD(
   QueryInterface
)(REFIID riid, _Deref_out_ void **ppvObject);

パラメーター

riid
インターフェイス ID。

ppvObject
この操作が完了するときの、riid パラメーターによって指定されたインターフェイスへのポインター。

戻り値

成功した場合は S_OK、そうでない場合は失敗を示す HRESULT。

ActivationFactory::Release

現在の ActivationFactory オブジェクトの参照カウントをデクリメントします。

STDMETHOD_(
   ULONG,
   Release
)();

戻り値

成功した場合は S_OK、そうでない場合は失敗を示す HRESULT。