winrt::get_activation_factory 함수 템플릿(C++/WinRT)
지정된 Windows 런타임 클래스 형식에 대한 활성화 팩터리를 검색하는 도우미 함수입니다.
구문
template <typename Class, typename Interface = winrt::Windows::Foundation::IActivationFactory>
auto get_activation_factory();
템플릿 매개 변수
typename Class
활성화 팩터리를 검색할 Windows 런타임 클래스 형식입니다.
typename Interface
활성화 팩터리에서 구현하는 인터페이스입니다.
반환 값
지정된 Windows 런타임 클래스 형식에 대한 활성화 팩터리의 지정된 인터페이스에 대한 참조입니다.
예제
auto factory = winrt::get_activation_factory<BankAccountWRC::BankAccount>();
BankAccountWRC::BankAccount account = factory.ActivateInstance<BankAccountWRC::BankAccount>();
using namespace winrt::Windows::Foundation;
...
auto factory = winrt::get_activation_factory<Uri, IUriRuntimeClassFactory>();
Uri account = factory.CreateUri(L"https://www.contoso.com");
using namespace winrt::Windows::Globalization::NumberFormatting;
...
auto factory = winrt::get_activation_factory<CurrencyFormatter, ICurrencyFormatterFactory>();
CurrencyFormatter currency = factory.CreateCurrencyFormatterCode(L"USD");
요구 사항
지원되는 최소 SDK: Windows SDK 버전 10.0.17134.0(Windows 10, 버전 1803)
네임스페이스: winrt
헤더: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion<>\cppwinrt\winrt\base.h(기본적으로 포함)