Hresult |
Value |
Description |
S_ OK |
Zero X 00000000 |
Successful |
S_false |
Zero X 00000001 |
The function is successfully executed, but an error is returned. |
E_invalidarg |
Zero X 80070057 |
Parameter Error |
E_outofmemory |
0x8007000e |
Memory application error |
E_unexpected |
0x8000ffff |
Unknown exception |
E_notimpl |
Zero X 80004001 |
Features not implemented |
E_fail |
Zero X 80004005 |
The error is not described in detail. Obtain the rich error message (note 1) |
E_pointer |
Zero X 80004003 |
Invalid Pointer |
E_handle |
Zero X 80070006 |
Invalid handle |
E_abort |
Zero X 80004004 |
Terminate operation |
E_accessdenied |
Zero X 80070005 |
Access denied |
E_nointerface |
Zero X 80004002 |
Unsupported Interface |
Figure 1 Structure of hresult
Hresult is actually a dubyte value. If the highest bit (BIT) is 0, the result is successful, and 1 indicates an error. For details, see "structure of COM error codes" in msdn. If we need to determine the return value in the program, we can use the comparison operator number, switch statement, or the macro provided by VC:
Hresult hR = call component functions; If (succeeded (HR )){...} // if it succeeds ...... if (failed (HR )){...} // if it fails