@@ -400,10 +400,9 @@ namespace winrt::impl
400400 return factory.call (static_cast <CastType>(callback));
401401 }
402402
403- template <typename Class, typename Interface = Windows::Foundation::IActivationFactory>
404- com_ref<Interface> try_get_activation_factory (hresult_error* exception = nullptr ) noexcept
403+ template <typename Interface = Windows::Foundation::IActivationFactory>
404+ com_ref<Interface> try_get_activation_factory (param::hstring const & name, hresult_error* exception = nullptr ) noexcept
405405 {
406- param::hstring const name{ name_of<Class>() };
407406 void * result{};
408407 hresult const hr = get_runtime_activation_factory<Interface>(name, &result);
409408
@@ -463,7 +462,7 @@ WINRT_EXPORT namespace winrt
463462 {
464463 // Normally, the callback avoids having to return a ref-counted object and the resulting AddRef/Release bump.
465464 // In this case we do want a unique reference, so we use the lambda to return one and thus produce an
466- // AddRef'd object that is returned to the caller.
465+ // AddRef'd object that is returned to the caller.
467466 return impl::call_factory<Class, Interface>([](auto && factory)
468467 {
469468 return factory;
@@ -473,13 +472,25 @@ WINRT_EXPORT namespace winrt
473472 template <typename Class, typename Interface = Windows::Foundation::IActivationFactory>
474473 auto try_get_activation_factory () noexcept
475474 {
476- return impl::try_get_activation_factory<Class, Interface>();
475+ return impl::try_get_activation_factory<Interface>(name_of<Class>() );
477476 }
478477
479478 template <typename Class, typename Interface = Windows::Foundation::IActivationFactory>
480479 auto try_get_activation_factory (hresult_error& exception) noexcept
481480 {
482- return impl::try_get_activation_factory<Class, Interface>(&exception);
481+ return impl::try_get_activation_factory<Interface>(name_of<Class>(), &exception);
482+ }
483+
484+ template <typename Interface = Windows::Foundation::IActivationFactory>
485+ auto try_get_activation_factory (param::hstring const & name) noexcept
486+ {
487+ return impl::try_get_activation_factory<Interface>(name);
488+ }
489+
490+ template <typename Interface = Windows::Foundation::IActivationFactory>
491+ auto try_get_activation_factory (param::hstring const & name, hresult_error& exception) noexcept
492+ {
493+ return impl::try_get_activation_factory<Interface>(name, &exception);
483494 }
484495
485496 inline void clear_factory_cache () noexcept
0 commit comments