Windows core programming Fifth Edition Study Notes (1)

Source: Internet
Author: User

Chapter 1 Error Handling

1,$ Err, HR can monitor this in the watch window of Vs to obtain the error code and detailed explanation of the Windows API that has just been executed.

2. Custom message code:

(Left to right)

31st ~ 30-bit (severity)

0 = Success

1 = informational

2 = warning

3 = Error

 

29th bits (Microsoft/customer)

(Note that the 29th-bit message code must be 1)

 

0 = Microsoft-defined code

1 = Customer-defined code

 

28th-bit (Reserved)

Must be 0

27th ~ 26-bit (Facility Code)

The first 256 values are reserved by Microsoft

 

The15 ~ 0-bit (Exception Code)

Microsoft/customer-defined code

 

3,The formatmessage function can format the message code into its corresponding string.

 

4. Application of the getlasterror () function

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.