InstantiateComponentFromPackage function (comppkgsup.h)

Creates an instance of a class in an application package.


HRESULT InstantiateComponentFromPackage(
  [in]  HSTRING      classId,
  [in]  HSTRING      packageFullName,
  [out] IInspectable **instance


[in] classId

The class to activate in the named package.

[in] packageFullName

The full name of the package.

[out] instance

Receives an instance of the class.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The function succeeded.
The class is not registered or the class is not listed under the registry key "HKEY_LOCAL_MACHINE\Software\Microsoft\MediaEngine\MediaExtensions\EME\CDMS". See remarks for more info.


This function can only be used with packages whose "PackageFamilyName" is defined as a subkey key that is registered under the "HKEY_LOCAL_MACHINE\Software\Microsoft\MediaEngine\MediaExtensions\EME\CDMS" key.

This API should only be called in very exceptional circumstances because code installed from the application store should not be invoked from desktop applications as it is has a lower level of trust associated with it.


Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header comppkgsup.h
Library Comppkgsup.lib
DLL CompPkgSup.dll