20060102

The differences between OnClose(), OnDestroy(), and DestroyWindow() (MFC/WinAPI stuff).

I knoticed one programmer uses OnClose() to try to prevent the user
from closing the window when they shouldn’t. To do this, he only called CDialog::OnClose() from his overloaded OnClose when closing was allowed.

OnDestroy() is another CWnd member. It’s called durring the
destruction of the CWnd object. This is probably the most useful
function for doing cleanup.

DestroyWindow() is yet another CWnd member. The MSDN documentation suggests that it might never get called unless the program explicity calls it. There is however a note that MFC’s might call it. Which, or when I’m not sure (isn’t CWnd part of MFC?).

Drew Scott Daniels

Resume: http://www.boxheap.net/ddaniels/resume.html

Originally from: http://www.boxheap.net/ddaniels/notes/20060102.html

Comments are closed.