EN
Det här innehållet finns inte tillgängligt på ditt språk men här finns den engelska versionen,
Det här ämnet har inte bedömts ännu - Bedöm det här ämnet

Using Macros for Error Handling

There are several macros for making it easier to work with HRESULT values.

There are two sets of macros that test for failure or success: HR_SUCCEEDED and HR_FAILED and SUCCEEDED and FAILED. SUCCEEDED is the same as HR_SUCCEEDED and FAILED is the same as HR_FAILED.

In this case, use the ResultFromScode macro to set the HRESULT variable to the corresponding HRESULT value for S_OK.

Commonly used macros are briefly described in the following table.

Macro Description

MAKE_HRESULT

Constructs an HRESULT from its components.

HR_SUCCEEDED

Tests an HRESULT for a success or warning condition.

HR_FAILED

Tests an HRESULT for an error condition.

HRESULT_CODE

Extracts the error code part of the HRESULT.

HRESULT_FACILITY

Extracts the facility from the HRESULT.

HRESULT_SEVERITY

Extracts the severity bit from the SEVERITY.

SUCCEEDED

Tests an HRESULT for a success or warning condition.

FAILED

Tests an HRESULT for an error condition.

Var detta till hjälp?
(1500 tecken kvar)
© 2013 Microsoft. Med ensamrätt.