HRESULT
Most COM function return an HRESULT. An HRESULT has 3 fields: an SCODE (the high bit), an MS-defined Facility, and the application-defined code.
Helper macros:
HRESULT_SEVERITY,SUCCEEDED,FAILED,IS_ERRORHRESULT_FACILITYandHRESULT_CODEMAKE_HRESULT
Win32 support:
FormatMessage can get strings from all the system HRESULTs, but it’s a little messy. Here’s a wrapper.
.NET interop
Many .NET exceptions map to HRESULTS.