The following table lists the values of common hresult values. More values are contained in the header file winerror. h.
Name |
Description |
Value |
S_ OK |
Operation successful |
Zero X 00000000 |
E_unexpected |
Unexpected failure |
0x8000ffff |
E_notimpl |
Not Implemented |
Zero X 80004001 |
E_outofmemory |
Failed to allocate necessary memory |
0x8007000e |
E_invalidarg |
One or more arguments are invalid |
Zero X 80070057 |
E_nointerface |
No such interface supported |
Zero X 80004002 |
E_pointer |
Invalid Pointer |
Zero X 80004003 |
E_handle |
Invalid handle |
Zero X 80070006 |
E_abort |
Operation aborted |
Zero X 80004004 |
E_fail |
Unspecified failure |
Zero X 80004005 |
E_accessdenied |
General Access Denied Error |
Zero X 80070005 |
S_false |
Operation Failure |
|
Hresult is actually a dubyte value. If the highest bit (BIT) is 0, the result is successful, and 1 indicates an error. 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