Windows program life and death

Source: Internet
Author: User

A thorough understanding of Windows message types and the occurrence time is exactlyProgramThe key to design. Now, with the advent and death of the window, I will describe the occurrence and transmission of messages, as well as the rise and end of applications. See figure 1-5 and figure 1-6.

Why is it so complicated to end a program? Because the operating system is different from the Application division, the two are in a cooperative relationship, so they must do their respective tasks and notify each other by message. If you do not follow this game rule, it may be troublesome. You can perform a small experiment to intercept wm_destroy in the window function, but do not call postquitmessage. When you select close in the System menu, the window disappears on the screen (because defwindowproc calls destroywindow to destroy the window and release the data structure ), however, the application itself is not over (because the message loop cannot end) and it is still stored in the memory.

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.