What is the difference between the virtual function destroywindow () and the window message ondestroy?

Source: Internet
Author: User

Q:

In the learning mode and mode-free dialog boxes today, it is found that the mode-free dialog box needs to be destroyed upon exit; otherwise, memory leakage may occur,
I will call destroywindow () in onok () in this mode-free dialog box, and then reload ondestory (), where Delete this; but the strange thing is that I call the virtual function destroywindow () however, the system calls the message ondestroy (), which is incorrect in my understanding, or is there another reason? Hope you can give me some advice!

A:

These two functions can be understood as active and passive.
The user calls destroywindows to close the window. When the window is closed, the ondestroy function is called!

 

If you call destroywindow (), the system will send a message of wm_destroy, which will call the ondestroy () function.

destroywindow () ------> wm_destroy + wm_ncdestroy ------> ondestroy ()
message sending Response Message ing

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.