Compartilhar via


HRESULT

4/8/2010

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.

Bb446131.3e4fcd45-7594-48df-9c92-00e86439486c(en-us,MSDN.10).gif

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).

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 on MSDN.

See Also

Reference

MAPI Data Types
SCODE

Other Resources

Messaging