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