I have a main window, with multiple browser windows as children of it, and a tab control to set the active / visible window.
What is happening is if the current tab runs some JavaScript that says to close itself, the browser seems to be sending WM_DESTROY to the main window parent, killing my app.
16:49:52 - WM_DESTROY = 1312418 (the parent not the browser window)
16:49:52 - ClientHandler::OnBeforeClose id=3
So browser with id #3 closes itself, but also closes the parent. This is not the case of the last window closing, there are 2 other windows open.
It happens before ClientHandler::OnBeforeClose so I can't try to do something like set its parent window to null. The JavaScript is not under my control.
Is there some other event I can trap that happens before WM_DESTROY is sent? Also, what is the right way to detach the browser from the parent so it stops trying to destroy it? Will setting the browser window's parent to NULL be enough or do I need to set some member variable or call some function?