winrt::try_get_activation_factory 함수 템플릿(C++/WinRT)

지정된 Windows 런타임 클래스 형식에 대한 정품 인증 팩터리를 검색하는 도우미 함수이거나, 성공하지 못한 경우 빈 com_ptr.

winrt::get_activation_factory 함수 템플릿도 참조하세요.

구문

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;

템플릿 매개 변수

typename Class활성화 팩터리를 검색할 Windows 런타임 클래스 형식입니다.

typename Interface 정품 인증 팩터리에서 구현하는 인터페이스입니다.

반환 값

지정된 Windows 런타임 클래스 형식에 대한 정품 인증 팩터리의 지정된 인터페이스에 대한 참조이거나, 성공하지 못한 경우 빈 com_ptr.

예제

이 예제에서는 클래스를 사용하기 전에 시스템에 클래스가 있는지 확인합니다. 예를 들어 클래스가 앱을 실행하는 컴퓨터와 다른 디바이스 패밀리에 있을 수 있습니다( 확장 SDK를 사용한 프로그래밍 참조). 아래에 표시된 기술은 공용 및 비공용 형식에서 작동합니다.

if (auto factory { winrt::try_get_activation_factory<Class>() })
{
    // use Class.
}

winrt::get_activation_factory 함수 템플릿에 대한 예제도 참조하세요.

요구 사항

지원되는 최소 SDK: Windows SDK 버전 10.0.17763.0(Windows 10, 버전 1809)

네임스페이스: winrt

헤더: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion<>\cppwinrt\winrt\base.h(기본적으로 포함)

참고 항목