A type representing an HRESULT error code.
Syntaxstruct hresult_error
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)
Constructors Types Static data members Member functions Member operators hresult_error::hresult_error constructorInitializes a new instance of the hresult_error struct with a copy of the input data.
Syntaxhresult_error() noexcept;
hresult_error(hresult_error&&);
hresult_error(hresult_error const& other);
explicit hresult_error(HRESULT const code) noexcept;
hresult_error(HRESULT const code, winrt::hstring const& message, ::IUnknown* object = nullptr) noexcept;
hresult_error(HRESULT const code, winrt::hresult_error::from_abi_t) noexcept;
Parameters
other
Another hresult_error that initializes the hresult_error object.
code
An HRESULT code that initializes the hresult_error object.
message
An informative string to help developers to correct the reported error condition.
object
An error object that stores extra information about the error. The error object should be apartment-agile, in-proc, and marshal-by-value across processes. It should implement ILanguageExceptionStackBackTrace and ILanguageExceptionTransform if necessary. See RoOriginateLanguageException.
Retrieves the code for the error represented by the hresult_error object.
Syntaxwinrt::hresult code() const noexcept;
Return value
A winrt::hresult error code.
hresult_error::from_abi static data memberAn instance of type hresult_error::from_abi_t, which can be passed to the constructor of hresult_error (or a derived type) to indicate that the constructor should try to retrieve restricted error info.
Syntaxstatic constexpr winrt::hresult_error::from_abi_t from_abi{};
hresult_error::from_abi_t type
The type of the hresult_error::from_abi static data member.
Syntaxstruct from_abi_t {};
hresult_error::message function
Retrieves the message for the error represented by the hresult_error object.
Syntaxwinrt::hstring message() const noexcept;
Return value
A winrt::hstring containing the error messsage.
hresult_error::operator= (assignment operator)Assigns a value to the hresult_error object.
Syntaxwinrt::hresult_error& operator=(winrt::hresult_error&&);
winrt::hresult_error& operator=(winrt::hresult_error const& other) noexcept;
Parameters
other
An hresult_error value to assign to the hresult_error object.
A reference to the hresult_error object.
hresult_error::to_abi functionSets the restricted error information object for the current thread, and returns the code for the error represented by the hresult_error object.
SyntaxHRESULT to_abi() const noexcept;
Return value
An HRESULT error code.
hresult_error::try_as functionReturns the requested interface, if it is supported. Returns nullptr
if it is not. This function is useful if you want to query for an interface that you don't need to pass back to your caller. For example, you can retrieve an IRestrictedErrorInfo to access the restricted error info for the error represented by the hresult_error object.
template <typename To> auto try_as() const noexcept;
Template parameters
typename To
The type of the requested interface.
to
A reference to a value to receive the requested interface.
A winrt::com_ptr referencing the requested interface, or a strongly-typed smart pointer for the requested interface (either declared by C++/WinRT or by a third party), if the requested interface is supported, otherwise nullptr
.
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