Before closing, set is as unactive:
::SetWindowLong(pviewclose->m_hWnd, GWL_ID, 0);
::SetWindowLong(pnewviewactive->m_hWnd, GWL_ID, AFX_IDW_PANE_FIRST);
If using new MFC, call a recalc (refresh) after done:
((CMDIFrameWndEx*)AfxGetMainWnd())->RecalcLayout();
If the view is doing things (executing a loop animation for example), end the loop before closing the view. Use a variable quit in the loop:
while (!quit)
{
MyCustomDraw();
CheckMessagesView();
}
void CMyView::CheckMessagesView()
{
MSG dispatch;
::PeekMessage( &dispatch, NULL, 0, 0, PM_NOREMOVE);
if (dispatch.message == WM_QUIT || dispatch.message == WM_CLOSE)
quit = TRUE;
AfxGetThread()->PumpMessage();
}
If you want a splash, you should use a Dialog.
Hope it helps.