Detailed introduction to the return value of the hresult Function

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.