// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_UI_Shell_CompanionWindows_H #define WINRT_Windows_UI_Shell_CompanionWindows_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/Windows.UI.Shell.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.UI.2.h" #include "winrt/impl/Windows.UI.Shell.CompanionWindows.2.h" namespace winrt::impl { template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::RequestWindowFromAppAsync(param::hstring const& appId) const { void* operation{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->RequestWindowFromAppAsync(*(void**)(&appId), &operation)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->RequestWindowFromAppAsync(*(void**)(&appId), &operation)); } return winrt::Windows::Foundation::IAsyncOperation{ operation, take_ownership_from_abi }; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::DetachCompanionWindow() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->DetachCompanionWindow()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->DetachCompanionWindow()); } } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::CompanionWindowId() const { winrt::Windows::UI::WindowId value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_CompanionWindowId(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_CompanionWindowId(put_abi(value))); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::Changed(winrt::Windows::Foundation::TypedEventHandler const& handler) const { winrt::event_token token{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->add_Changed(*(void**)(&handler), put_abi(token))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->add_Changed(*(void**)(&handler), put_abi(token))); } return token; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::Changed(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& handler) const { return impl::make_event_revoker(this, Changed(handler)); } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinator::Changed(winrt::event_token const& token) const noexcept { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; _winrt_abi_type->remove_Changed(impl::bind_in(token)); } else { auto const _winrt_abi_type = *(abi_t**)this; _winrt_abi_type->remove_Changed(impl::bind_in(token)); } } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowCoordinatorStatics::GetForWindow(winrt::Windows::UI::WindowId const& windowId) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetForWindow(impl::bind_in(windowId), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForWindow(impl::bind_in(windowId), &result)); } return winrt::Windows::UI::Shell::CompanionWindows::CompanionWindowCoordinator{ result, take_ownership_from_abi }; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequest::Accept(winrt::Windows::UI::WindowId const& windowId) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Accept(impl::bind_in(windowId), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Accept(impl::bind_in(windowId), &result)); } return winrt::Windows::UI::Shell::CompanionWindows::CompanionWindowCoordinator{ result, take_ownership_from_abi }; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequest::Reject() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Reject()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Reject()); } } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequest::GetDeferral() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDeferral(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeferral(&result)); } return winrt::Windows::Foundation::Deferral{ result, take_ownership_from_abi }; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequest::RequestingWindowId() const { winrt::Windows::UI::WindowId value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_RequestingWindowId(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_RequestingWindowId(put_abi(value))); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequestResult::Succeeded() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Succeeded(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Succeeded(&value)); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequestResult::Status() const { winrt::Windows::UI::Shell::CompanionWindows::CompanionWindowRequestResultStatus value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequestResult::ExtendedError() const { winrt::hresult value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ExtendedError(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ExtendedError(put_abi(value))); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequestResult::CompanionWindowId() const { winrt::Windows::UI::WindowId value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_CompanionWindowId(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_CompanionWindowId(put_abi(value))); } return value; } template auto consume_Windows_UI_Shell_CompanionWindows_ICompanionWindowRequestStatics::GetFromLaunchUri(winrt::Windows::Foundation::Uri const& launchUri) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetFromLaunchUri(*(void**)(&launchUri), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetFromLaunchUri(*(void**)(&launchUri), &result)); } return winrt::Windows::UI::Shell::CompanionWindows::CompanionWindowRequest{ result, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall RequestWindowFromAppAsync(void* appId, void** operation) noexcept final try { clear_abi(operation); typename D::abi_guard guard(this->shim()); *operation = detach_from>(this->shim().RequestWindowFromAppAsync(*reinterpret_cast(&appId))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall DetachCompanionWindow() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().DetachCompanionWindow(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_CompanionWindowId(struct struct_Windows_UI_WindowId* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().CompanionWindowId()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_Changed(void* handler, winrt::event_token* token) noexcept final try { zero_abi(token); typename D::abi_guard guard(this->shim()); *token = detach_from(this->shim().Changed(*reinterpret_cast const*>(&handler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_Changed(winrt::event_token token) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().Changed(*reinterpret_cast(&token)); return 0; } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetForWindow(struct struct_Windows_UI_WindowId windowId, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetForWindow(*reinterpret_cast(&windowId))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Accept(struct struct_Windows_UI_WindowId windowId, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Accept(*reinterpret_cast(&windowId))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Reject() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Reject(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDeferral(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetDeferral()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_RequestingWindowId(struct struct_Windows_UI_WindowId* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().RequestingWindowId()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Succeeded(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Succeeded()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Status(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Status()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ExtendedError(winrt::hresult* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ExtendedError()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_CompanionWindowId(struct struct_Windows_UI_WindowId* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().CompanionWindowId()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetFromLaunchUri(void* launchUri, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetFromLaunchUri(*reinterpret_cast(&launchUri))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::UI::Shell::CompanionWindows { inline auto CompanionWindowCoordinator::GetForWindow(winrt::Windows::UI::WindowId const& windowId) { return impl::call_factory([&](ICompanionWindowCoordinatorStatics const& f) { return f.GetForWindow(windowId); }); } inline auto CompanionWindowRequest::GetFromLaunchUri(winrt::Windows::Foundation::Uri const& launchUri) { return impl::call_factory([&](ICompanionWindowRequestStatics const& f) { return f.GetFromLaunchUri(launchUri); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif