A helper function that retrieves the activation factory for a specified Windows Runtime class type or an empty com_ptr if not successful.
Also see the winrt::get_activation_factory function template.
Syntaxtemplate <typename Class, typename Interface = Windows::Foundation::IActivationFactory>
auto try_get_activation_factory() noexcept;
template <typename Class, typename Interface = Windows::Foundation::IActivationFactory>
auto try_get_activation_factory(hresult_error& exception) noexcept;
Template parameters
typename Class
A Windows Runtime class type whose activation factory to retrieve.
typename Interface
An interface implemented by the activation factory.
A reference to the specified interface of the activation factory for the specified Windows Runtime class type or an empty com_ptr if not successful.
ExampleThis example verifies that a class is present on the system before using it. For example, the class might be in a different device family from that of the machine running the app (see Programming with extension SDKs). The technique shown below works with public and non-public types.
if (auto factory { winrt::try_get_activation_factory<Class>() })
{
// use Class.
}
Also see the examples for winrt::get_activation_factory function template.
RequirementsMinimum supported SDK: Windows SDK version 10.0.17763.0 (Windows 10, version 1809)
Namespace: winrt
Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)
See alsoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4