RoActivateInstance function (roapi.h)

Activates the specified Windows Runtime class.

Syntax

HRESULT RoActivateInstance(
  [in]  HSTRING      activatableClassId,
  [out] IInspectable **instance
);

Parameters

[in] activatableClassId

Type: HSTRING

The class identifier that is associated with the activatable runtime class.

[out] instance

Type: IInspectable**

A pointer to the activated instance of the runtime class.

Return value

Type: HRESULT

This function can return one of these values.

Return code Description
S_OK
The class was activated successfully.
E_POINTER
instance is NULL.
CO_E_NOTINITIALIZED
The thread has not been initialized in the Windows Runtime by calling the RoInitialize function.
E_ACCESSDENIED
The TrustLevel for the class requires a full-trust process.
E_NOINTERFACE
The IInspectable interface is not implemented by the specified class.
E_OUTOFMEMORY
Failed to create an instance of the class.

Remarks

Use the RoActivateInstance function to activate a Windows Runtime class. The RoActivateInstance function connects to the activation factory that is associated with the specified activatable class identifier, creates an instance by calling the zero-argument constructor on the class, and releases the activation factory.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header roapi.h

See also

CoCreateInstance

IActivationFactory

IInspectable

TrustLevel