Drew Scott Daniels' Blog Personal, usually technical posts

January 2, 2006

20060102

Filed under: Uncategorized — admin @ 8:00 pm

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

Powered by WordPress