Muokkaa

Jaa


SimpleActivationFactory Class

Provides a fundamental mechanism to create a Windows Runtime or classic COM base class.

Syntax

template<typename Base>
class SimpleActivationFactory : public ActivationFactory<>;

Parameters

Base
A base class.

Remarks

The base class must provide a default constructor.

The following code example demonstrates how to use SimpleActivationFactory with the ActivatableClassWithFactoryEx macro.

ActivatableClassWithFactoryEx(MyClass, SimpleActivationFactory, MyServerName);

Members

Public Methods

Name Description
SimpleActivationFactory::ActivateInstance Method Creates an instance of the specified interface.
SimpleActivationFactory::GetRuntimeClassName Method Gets the runtime class name of an instance of the class specified by the Base class template parameter.
SimpleActivationFactory::GetTrustLevel Method Gets the trust level of an instance of the class specified by the Base class template parameter.

Inheritance Hierarchy

I0

ChainInterfaces

I0

RuntimeClassBase

ImplementsHelper

DontUseNewUseMake

RuntimeClassFlags

RuntimeClassBaseT

RuntimeClass

ActivationFactory

SimpleActivationFactory

Requirements

Header: module.h

Namespace: Microsoft::WRL

SimpleActivationFactory::ActivateInstance Method

Creates an instance of the specified interface.

STDMETHOD( ActivateInstance )(
    _Deref_out_ IInspectable **ppvObject
);

Parameters

ppvObject
When this operation completes, pointer to an instance of the object specified by the Base class template parameter.

Return Value

S_OK if successful; otherwise, an HRESULT that indicates the error.

Remarks

If __WRL_STRICT__ is defined, an assert error is emitted if the base class specified in the class template parameter isn't derived from RuntimeClass, or isn't configured with the WinRt or WinRtClassicComMix RuntimeClassType enumeration value.

SimpleActivationFactory::GetRuntimeClassName Method

Gets the runtime class name of an instance of the class specified by the Base class template parameter.

STDMETHOD( GetRuntimeClassName )(
    _Out_ HSTRING* runtimeName
);

Parameters

runtimeName
When this operation completes, the runtime class name.

Return Value

S_OK if successful; otherwise, an HRESULT that indicates the error.

Remarks

If __WRL_STRICT__ is defined, an assert error is emitted if the class specified by the Base class template parameter isn't derived from RuntimeClass, or isn't configured with the WinRt or WinRtClassicComMix RuntimeClassType enumeration value.

SimpleActivationFactory::GetTrustLevel Method

Gets the trust level of an instance of the class specified by the Base class template parameter.

STDMETHOD(
   GetTrustLevel
)(_Out_ TrustLevel* trustLvl);

Parameters

trustLvl
When this operation completes, the trust level of the current class object.

Return Value

Always S_OK.