Share via


HRESULT (Compact 7)

3/12/2014

The HRESULT data type is a 32-bit value is used to describe an error or warning.

Note

Most MAPI methods and functions return HRESULT values to provide detailed result information. HRESULT values are also used widely in COM interface methods.

Syntax

ULONG HRESULT;

Remarks

The return value of COM functions and methods is an HRESULT, which is not a handle to an object, but is a 32-bit value with several fields encoded in a single 32-bit ULONG variable.

The following figure represents an HRESULT value.

The following table shows how to decode the information contained in an HRESULT.

Section Description Size in bits Interpretation

S

The severity code

1

Indicates success or failure.

0 - Success (SEVERITY_SUCCESS).

1 - Fail (SEVERITY_ERROR).

R

A reserved bit

1

Ignore.

C

A reserved bit

1

Ignore.

N

A reserved bit

1

Ignore.

r

A reserved bit

1

Ignore.

Facility

The facility code

11

Specifies the software component that defines this error code. For example, FACILITY_RPC.

Code

The facility's status code

16

A code describing the error or warning. For example, E_UNEXPECTED. See System Errors - Numerical Order for a listing of possible system error values.

Definitions for error and warning codes are contained in the winerror.h header file.

On 32-bit platforms, the SCODE data type is the same as the HRESULT data type.

For more information on error and warning codes, see Error Values, and the Structure of COM Error Codes on MSDN.

See Also

Reference

MAPI Data Types
SCODE