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

A helper function that checks whether an HRESULT code represents an error and, if so, calls the winrt::throw_hresult function to throw an exception that represents the error code. Also see winrt::hresult_error.

Syntax

void check_hresult(HRESULT const result);

Parameters

result An HRESULT code, which may be a success code or an error code. An exception is thrown only if result is an error code.

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