What type is hresult?

Source: Internet
Author: User

From: http://hi.baidu.com/hankcs/blog/item/7a5cc2080b8a2cc43ac76342.html

To put it simply, it is to judge the function execution result.

Com requires that all methods return an error code of the hresult type. Hresult is actually defined as a Type:

typedef LONG HRESULT;
The Return Value of the hresult type reflects some situations in the function. Its Type Definition specifications are as follows:
31 30 29 28 16 15 0
| ----- | -- | ------------------------ | ----------------------------------- | Category code (30-31) reflects the function call result:
00 call successful
01 contains some information
10 warning
11 Error
User-Defined mark (29) indicates whether the result is a user-defined mark, 1 is yes, 0 is not;
The operation code (16-28) identifies the result operation source, which is defined as follows on Windows:
# Define facility_windows 8
# Define facility_storage 3
# Define facility_rpc 1
# Define facility_sspi 9
# Define facility_win32 7
# Define facility_control 10
# Define facility_null 0
# Define facility_internet 12
# Define facility_itf 4
# Define facility_dispatch 2
# Define facility_cert 11
The operation result code (0-15) indicates the operation status. winerror. h defines all possible results returned by the Win32 function.
The following are some frequently used return values and macro definitions:
S_ OK: The function is successfully executed, and its value is 0 (Note: its value is opposite to true)
S_false: The function is successfully executed. Its value is 1.
S_fail: The function fails to be executed. The cause of failure is unknown.
The e_outofmemory function fails to be executed because the memory allocation fails.
E_notimpl function execution failed, member function not implemented
The e_notinterface function fails to be executed. If the component does not implement the specified interface, the returned values cannot be compared with s_ OK and s_false, but the values must be determined using the secceeded and failed macros.

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.