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(기본적으로 포함)
참고 항목
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기