共用方式為


HRESULT

Applies to: Office 2010 | Outlook 2010 | Visual Studio

A 32-bit value that is used to describe an error or warning.

typedef LONG HRESULT;

Remarks

The HRESULT data type is the same as the SCODE data type.

An HRESULT value consists of the following fields:

  • A 1-bit code indicating severity, where zero represents success and 1 represents failure.

  • A 4-bit reserved value.

  • An 11-bit code indicating responsibility for the error or warning, also known as a facility code.

  • A 16-bit code describing the error or warning.

Most MAPI interface methods and functions return HRESULT values to provide detailed cause formation. HRESULT values are also used widely in OLE interface methods. OLE provides several macros for converting between HRESULT values and SCODE values, another common data type for error handling.

Note

In 64-bit MAPI, HRESULT is still a 32-bit value.

For information about the OLE use of HRESULT values, see the OLE Programmer's Reference. For more information about the use of these values in MAPI, see Error Handling and any of the following interface methods:

IABLogon::GetLastError

IMAPISupport::GetLastError

IMAPIControl::GetLastError

IMAPITable::GetLastError

IMAPIProp::GetLastError

IMAPIViewAdviseSink::OnPrint

See Also

Reference

SCODE

Concepts

MAPI Data Types