winrt::check_win32 function template (C++/WinRT)

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

Syntax

template<typename T>
void check_win32(T result);

Template parameters

typename T An integer type.

Parameters

result A 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