Release and test of GDI objects

Source: Internet
Author: User

1. BUG:

The program has an inexplicable error. The error location is cview: onclienttodc, ondraw, onpaint, and so on.

There is a message warning: uncaught exception in windowproc (returning 0 ).

2. Conclusion:

GDI object does not have release

3. Code requirements:

The Code contains getdc () but does not call releasedc (CDC * PDC ).

Knowledge point:

1. deletedc corresponds to createdc; releasedc corresponds to getdc

Getdc (): This function releases a device context (DC), freeing it for use by other applications.

If you do not use them in pairs, there will be a DC resource problem. The GDI object will occupy more and more resources. When the number exceeds 10,000, the program will crash.

2. Test Method

Task Manager, "View" menu, select "Select column...", and select "GDI object"

Task Manager, "View" menu, select "select columns", pick up "GDI objects"

Summary:

1. Pay attention to the Methods declared in msdn to be used in pairs.

2. Make good use of test tools. Basic performance tests allow you to make full use of the task manager. Very helpful

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.