winrt::hresult_error 구조체(C++/WinRT)

HRESULT 오류 코드를 나타내는 형식입니다.

Syntax

struct hresult_error

요구 사항

지원되는 최소 SDK: Windows SDK 버전 10.0.17134.0(Windows 10, 버전 1803)

네임스페이스: winrt

헤더: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion<>\cppwinrt\winrt\base.h(기본적으로 포함)

생성자

생성자 Description
hresult_error::hresult_error 생성자 입력 데이터의 복사본을 사용하여 hresult_error 구조체의 새 인스턴스를 초기화합니다.

형식

생성자 Description
hresult_error::from_abi_t 형식 hresult_error::from_abi 정적 데이터 멤버의 형식입니다.

정적 데이터 멤버

기능 설명
hresult_error::from_abi 정적 데이터 멤버 hresult_error::from_abi_t 형식의 인스턴스로, hresult_error 생성자(또는 파생 형식)에 전달되어 생성자가 제한된 오류 정보를 검색해야 함을 나타냅니다.

멤버 함수

기능 설명
hresult_error::code 함수 hresult_error 개체가 나타내는 오류에 대한 코드를 검색합니다.
hresult_error::message 함수 hresult_error 개체가 나타내는 오류에 대한 메시지를 검색합니다.
hresult_error::to_abi 함수 현재 스레드에 대해 제한된 오류 정보 개체를 설정하고 hresult_error 개체가 나타내는 오류에 대한 코드를 반환합니다.
hresult_error::try_as 함수 지원되는 경우 요청된 인터페이스를 반환합니다. 반환하거나false, 반환하지 않으면 반환nullptr합니다.

멤버 연산자

연산자 설명
hresult_error::operator=(대입 연산자) hresult_error 개체에 값을 할당합니다.

hresult_error::hresult_error 생성자

입력 데이터의 복사본을 사용하여 hresult_error 구조체의 새 인스턴스를 초기화합니다.

구문

hresult_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;

매개 변수

otherhresult_error 개체를 초기화하는 또 다른 hresult_error.

codehresult_error 개체를 초기화하는 HRESULT 코드입니다.

message 개발자가 보고된 오류 조건을 수정하는 데 도움이 되는 정보 문자열입니다.

object 오류에 대한 추가 정보를 저장하는 오류 개체입니다. 오류 개체는 프로세스 간에 아파트-agile, in-proc 및 마샬링 값이어야 합니다. 필요한 경우 ILanguageExceptionStackBackTraceILanguageExceptionTransform을 구현해야 합니다. RoOriginateLanguageException을 참조하세요.

hresult_error::code 함수

hresult_error 개체가 나타내는 오류에 대한 코드를 검색합니다.

구문

winrt::hresult code() const noexcept;

반환 값

winrt::hresult 오류 코드입니다.

hresult_error::from_abi 정적 데이터 멤버

hresult_error::from_abi_t 형식의 인스턴스로, hresult_error 생성자(또는 파생 형식)에 전달되어 생성자가 제한된 오류 정보를 검색해야 함을 나타냅니다.

구문

static constexpr winrt::hresult_error::from_abi_t from_abi{};

hresult_error::from_abi_t 형식

hresult_error::from_abi 정적 데이터 멤버의 형식입니다.

구문

struct from_abi_t {};

hresult_error::message 함수

hresult_error 개체가 나타내는 오류에 대한 메시지를 검색합니다.

구문

winrt::hstring message() const noexcept;

반환 값

오류 혼란을 포함하는 winrt::hstring 입니다.

hresult_error::operator=(대입 연산자)

hresult_error 개체에 값을 할당합니다.

구문

winrt::hresult_error& operator=(winrt::hresult_error&&);
winrt::hresult_error& operator=(winrt::hresult_error const& other) noexcept;

매개 변수

otherhresult_error 개체에 할당할 hresult_error 값입니다.

반환 값

hresult_error 개체에 대한 참조입니다.

hresult_error::to_abi 함수

현재 스레드에 대해 제한된 오류 정보 개체를 설정하고 hresult_error 개체가 나타내는 오류에 대한 코드를 반환합니다.

구문

HRESULT to_abi() const noexcept;

반환 값

HRESULT 오류 코드입니다.

hresult_error::try_as 함수

지원되는 경우 요청된 인터페이스를 반환합니다. 그렇지 않은 경우 반환 nullptr 합니다. 이 함수는 호출자에게 다시 전달할 필요가 없는 인터페이스를 쿼리하려는 경우에 유용합니다. 예를 들어 IRestrictedErrorInfo 를 검색하여 hresult_error 개체가 나타내는 오류에 대한 제한된 오류 정보에 액세스할 수 있습니다.

구문

template <typename To> auto try_as() const noexcept;

템플릿 매개 변수

typename To 요청된 인터페이스의 형식입니다.

매개 변수

to 요청된 인터페이스를 받을 값에 대한 참조입니다.

반환 값

요청된 인터페이스를 참조하는 winrt::com_ptr 또는 요청된 인터페이스가 지원 nullptr되는 경우 요청된 인터페이스(C++/WinRT 또는 타사에 의해 선언됨)에 대한 강력한 형식의 스마트 포인터입니다.

참고 항목