Share via


HRESULT

Send Feedback

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 is contained in the winerror.h header file. By default, this file is copied to the following location when you install the Windows Mobile Verison 5.0 Pocket PC SDK:

C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include\Armv4i\winerror.h

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

MAPI Data Types | Messaging | SCODE

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.