HRESULT

HRESULT is a data type that is a 32-bit error or warning value.

typedef LONG          HRESULT;

 

Remarks

An HRESULT data type is made up of a 1-bit severity flag, an 11-bit handle, a 4-bit facility code indicating status code (SCODE) group, and a 16-bit SCODE information code. A value of zero for the severity flag indicates the success of the operation for which the HRESULT was returned.

An HRESULT type returned as an error value for a function can provide the application that called the function information on the error and how to recover from it. To obtain this information, the application uses the handle of the HRESULT. The HRESULT and SCODE types are not equivalent. OLE includes functions and macros to convert between error values of these two types. To create an HRESULT value from an SCODE value, use ResultFromScode(SCODE). To convert an HRESULT form to SCODE value, use GetScode(HRESULT). For details about ResultFromScode and GetScode and for faster ways of making the conversions just mentioned, see the OLE Programmer s Reference. For a description of the OLE implementation of HRESULT, see Inside OLE, Second Edition, by Kraig Brockschmidt.

See Also

SCODE