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/error-handling/to-hresult below:

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

winrt::to_hresult function (C++/WinRT)

In this article

A helper function, for use in a catch block, that turns the last exception thrown into a HRESULT error code. In a catch block that catches winrt::hresult_error, you can get an HRESULT directly from that type by using the hresult_error::to_abi member function. In other catch blocks, you can call the winrt::to_hresult function to get a HRESULT, if the exception that was thrown is any of: winrt::hresult_error, std::bad_alloc, std::out_of_range, std::invalid_argument, or std::exception.

to_hresult is a low-level function that you'll seldom need to use.

Syntax
inline __declspec(noinline) HRESULT to_hresult() noexcept;
Return value

The HRESULT error code represented by the last exception thrown.

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

Additional resources

In this article

Was this page helpful?


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