A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/uwp/cpp-ref-for-winrt/try-get-activation-factory below:

winrt::try_get_activation_factory function template (C++/WinRT) - Windows UWP applications

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.

Syntax
template <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.

Return value

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.

Example

This 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.

Requirements

Minimum 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 also

RetroSearch 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