Hi all,
I have an application where i have three views. The mainframe calls two views (slaveframes) which are identical and a child view.
I have a button on the slaveframes of the views to Logout which effectively call the OnClose method of the MainFrame. When I either hit the File|Exit or the logout in the slaveframe, I get a message box to logout. This appears in the slaveframe ie the view that called it. However when i hit the X in the top right hand corner, the logout box appears in the childview. I'm not entirely sure why this is happening as I am overriding the OnClose for the File|Exit, the X and also the Logout button. Any help on how to fix this would be greatly appreciated as it is very annoying!
Below is my code for the OnClose in the ChildView, SlaveFrame and MainFrame:
void CMainFrame::OnClose()
{
if( AfxMessageBox( IDS_LOGOUT_SURE, MB_ICONQUESTION | MB_YESNO ) == IDYES )
{
KillTimer( TIMER_ID_RECONNECT );
//m_Events.Event( CARGO_USEREVENT_LOGOUT );
m_Connection.Disconnect();
m_HardwareConnection.Disconnect();
RapiLogOff();
CFrameWnd::OnClose();
}
}
void CSlaveFrame::OnLogout( void )
{
OnClose();
}
void CSlaveFrame::OnClose( void )
{
pMainFrame->OnClose();
}