In a multi-view MFC application where one of the views displays an Irrlicht scene, the application exits when this view is closed. We tracked the problem down to CIrrDeviceWin32::closeDevice() that generates the WM_QUIT message by calling PostQuitMessage. In approximately 4 cases out of 5 this message is picked up by the MFC application causing the application to terminate when it should not. The problem can be solved by removing the PostQuitMessage from closeDevice.
There doesn't appear to be a WM_QUIT message handler in the library and I see no reason for posting the message from the library, so I think that posting this message is a bug.
The same code is in CIrrDeviceWinCE. It is also present in the trunk.
The call to PostQuitMessage was introduced in r1007 as a fix. It was used in combination with DestroyWindow for destroying the "internal" window. Later external windows were introduced and DestroyWindow was called only for internal windows. But PostQuitMessage was kept for all windows which is probably not correct. The block with message processing should probably be used only for the internal window (patch provided).
Thanks for finding and even researching where it came from. Explanation sounds likely and I also found not problem in the Win32Window example.
Fixed now in svn trunk r6135.