A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/uwp/cpp-ref-for-winrt/try-capture below:

winrt::try_capture function template (C++/WinRT) - Windows UWP applications

A function template that calls a specified function or method (automatically calling winrt::check_hresult on it), captures the interface pointer that's output from the function or method, and returns it as the template parameter typename T if T derives from Windows::Foundation::IUnknown, otherwise, returns a winrt::com_ptr. Returns an empty com_ptr if not successful.

Also see the winrt::com_ptr::try_capture function.

Syntax
template <typename T, typename F, typename...Args>
impl::com_ref<T> try_capture(F function, Args&& ...args);

template <typename T, typename O, typename M, typename...Args>
impl::com_ref<T> try_capture(O* p, M method, Args&& ...args);

template <typename T, typename O, typename M, typename...Args>
impl::com_ref<T> try_capture(com_ptr<O> const& object, M method, Args&& ...args);
Template parameters

typename T The type of the interface pointer that's output from the function or method.

typename F A function object type, such as a free function, or std::function.

typename O An interface type.

typename M A method type.

typename Args Zero or more argument types.

Parameters

function A function object of type F.

p A pointer to an object of type O.

object A winrt::com_ptr of type O.

method A method (implemented by O) of type M.

args Zero or more arguments of type Args.

Return value

Returns T if T derives from Windows::Foundation::IUnknown, otherwise, returns winrt::com_ptr. Returns an empty com_ptr if not successful.

All overloads pass through (to the invokee) any additional arguments that you provide. All overloads also pass the two additional arguments that such invokees require—specifically, a REFIID (the ID of the target of the winrt::com_ptr), and a void** (The address of a pointer to the target of the winrt::com_ptr).

Requirements

Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)

See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4