LRESULT CMsgSignalDBWnd::OnSaveDBJ1939(WPARAM /* wParam */, LPARAM /*lParam*/) { // Get active frame CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; if (pFrame != nullptr) { // Get appropriate data structure CMsgSignal** ppTempMsgSg = nullptr; ppTempMsgSg = (CMsgSignal**)(m_sDbParams.m_ppvActiveDB); pFrame->podGetMsgSgDetView(m_sDbParams.m_eBus); if ((*ppTempMsgSg)->bGetModifiedFlag() == FALSE) { vSaveModifiedDBs(ppTempMsgSg); } } return 0; }
LRESULT CMsgSignalDBWnd::OnSaveDBJ1939(WPARAM wParam, LPARAM /*lParam*/) { // Get active frame CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; if (pFrame != NULL) { // Get appropriate data structure CMsgSignal** ppTempMsgSg = NULL; ppTempMsgSg = (CMsgSignal**)(m_sDbParams.m_ppvActiveDB); pFrame->podGetMsgSgDetView(m_sDbParams.m_eBus); if ((*ppTempMsgSg)->bGetModifiedFlag() == FALSE) { vSaveModifiedDBs(ppTempMsgSg); } // delete previously allocated memory if any (*ppTempMsgSg)->bDeAllocateMemoryInactive(); } return 0; }
void CMsgSignalDBWnd::OnClose() { // Get active frame CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; if (pFrame != NULL) { // Get appropriate data structure CMsgSignal** ppTempMsgSg = NULL; ppTempMsgSg = (CMsgSignal**)(m_sDbParams.m_ppvActiveDB); //CMsgSgDetView* podMsgSg = pFrame->podGetMsgSgDetView(m_sDbParams.m_eBus); if ((*ppTempMsgSg)->bGetModifiedFlag() == FALSE) { UINT bRetVal = AfxMessageBox(ASK_SAVE_PROMPT, MB_YESNO|MB_ICONQUESTION); if ( bRetVal == IDYES ) { //save the database modificatins. vSaveModifiedDBs(ppTempMsgSg); } else if( bRetVal == IDNO ) { // if this is new database // then delete the memory and the file itself if ( pFrame->vGetNewDatabaseFlag()) { // This file is no longer required CFile::Remove( m_sDbParams.m_omDBPath ); pFrame->vSetNewDatabaseFlag(FALSE); } } } else { // If the user just creates new database, // and closes the window // delete the file if ( pFrame->vGetNewDatabaseFlag() ) { // This file is no longer required CFile::Remove( m_sDbParams.m_omDBPath ); pFrame->vSetNewDatabaseFlag(FALSE); } } // delete previously allocated memory if any (*ppTempMsgSg)->bDeAllocateMemoryInactive(); // Reset the flag to indicate the closing of database window if (m_sDbParams.m_eBus == CAN) { CFlags* pFlags = theApp.pouGetFlagsPtr(); if ( pFlags != NULL ) { pFlags->vSetFlagStatus( DBOPEN, FALSE ); } } else if (m_sDbParams.m_eBus == J1939) { CMsgSignalDBWnd::sm_bValidJ1939Wnd = FALSE; } CMDIChildWnd::OnClose(); } }