typedef _Return_type_success_(return >= 0) long HRESULT;

typedef _Return_type_success_(return >= 0) long HRESULT;

This is a declaration similar to defining a macro. What is defined HRESULTis actually the return type of an API function in common Windows programming, which is used to represent the execution result or error code of the function. This definition uses macros _Return_type_success_that Microsoft defines in some header files to indicate whether a function operation was successful or not.

In this definition, typedefkeywords are used to create an alias for a type. longRenaming the type to here HRESULTwill make it easier to use and make it more descriptive. _Return_type_success_The macro is used to indicate: the return value of this type of function must be non-negative (that is, the return value is greater than or equal to 0), if a function returns a value less than 0, it will be regarded as an operation failure.

In Windows programming, HRESULTthe type is usually used to represent the execution result or error code of a function, such as common functions provided by COM (Component Object Model) and Win32 API. This error code can help developers judge whether the function is executed successfully, so as to take corresponding error handling and exception handling measures.

Guess you like

Origin blog.csdn.net/m0_51913750/article/details/131005266
Recommended