1

I have a window that is created and OnDestroy() is called at some point without the user ever clicking on the 'Close' or 'X' button which closes the window.

What other operations/actions/things could possibly cause this function to be called and why?

Microsoft's documentation is useless as per usual:

http://msdn.microsoft.com/en-us/library/vstudio/2eahe3wf.aspx

Brian T Hannan
  • 3,925
  • 18
  • 56
  • 96
  • Child windows, deleting the data inside a CWnd (I am assuming there is some sort of pointer to it), and the clipboard. I am not experienced with this, but those are my guesses :-/ – The Floating Brain Oct 08 '13 at 21:57
  • Thanks, but unfortunately there are no child windows for this modal dialog as it is a lonely child to its parent. There is no explicit deletion of any of the data inside the CWnd and the clipboard is not used. – Brian T Hannan Oct 09 '13 at 14:52
  • @BrainTHannan is there any event occurring to the parent window that could influence the problematic child window? – The Floating Brain Oct 10 '13 at 01:58

1 Answers1

0

It's not documented because the list would be pretty long. For instance, a common reason is pressing Alt-F4. After all, that sends the same WM_CLOSE message. In fact, anything that sends WM_CLOSE to your window would cause this.

There's also application shutdown, possibly because the PC is powering off, or because the user logs off.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Thanks, but unfortunately none of this is happening. It is trying to process some data in a list within the modal window. It gets caught up at some point and the crash dump points to the OnDestroy() function. Can an exception or anything like that cause this function to be called? – Brian T Hannan Oct 09 '13 at 14:47