/*******************************************************************************
  Function Name  : vInitFilterDataList
  Input(s)       : -
  Output         : -
  Functionality  : To initialise message filter list data
  Member of      : CMsgFilterConfigPage
  Author(s)      : Raja N
  Date Created   : 8.7.2005
  Modifications  :
*******************************************************************************/
VOID CMsgFilterConfigPage::vInitFilterDataList()
{
#if 0
    // Get the data from config module and update local list
    CModuleFilterArray* psData = &m_omFilterList;
    // Update Filter List
    theApp.bGetData( MSG_DISPLAY_FILTER_DETAILS, (void** )&psData );
#endif
}
Beispiel #2
0
BOOL CMsgSignalDBWnd::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
                                     CCreateContext* pContext)
{
    // Set Icon for DB Window
    SetIcon( theApp.LoadIcon( IDI_ICO_DB_EDITOR ), TRUE );
    // Create Static Splitter Window with 1 ROW and 2 COLUMNS
    m_bSplitWndCreated  =
        m_omSplitterWnd.CreateStatic(   this,                   // Parent Frame Window
                                        SPLT_ONE_ROWS,          // #Rows
                                        SPLT_ONE_COLS,          // #Columns
                                        WS_CHILD    |
                                        WS_VISIBLE |
                                        WS_BORDER,              // Window Style
                                        AFX_IDW_PANE_FIRST);    // Splitter NOT Nested
    // Get size of Frame wnd
    CSize om_Size(0,0);
    vCalculateSplitterPosition(om_Size);

    if ( TRUE == m_bSplitWndCreated )
    {
        // Create the Right Pane for static splitter window
        CMsgSgDetView::sm_sDbParams = m_sDbParams;
        m_bSplitWndCreated  =
            m_omSplitterWnd.CreateView( FIRST_ROW,                      // #Row
                                        SECOND_COL,                     // #Column
                                        RUNTIME_CLASS(CMsgSgDetView),   // View associated with
                                        om_Size,                        // Sizeof Pane
                                        pContext);
    }

    if ( TRUE == m_bSplitWndCreated )
    {
        // Create the Left Pane for static splitter window
        CMsgSgTreeView::sm_sDbParams = m_sDbParams;
        m_bSplitWndCreated  =
            m_omSplitterWnd.CreateView( FIRST_ROW,                      // #Row
                                        FIRST_COL,                      // #Column
                                        RUNTIME_CLASS(CMsgSgTreeView),  // View associated with
                                        om_Size,                        //CSize( 350,100 ),                 // Sizeof Pane
                                        pContext);
    }

    CString omTitle = _T("DatabaseEditor - ");
    omTitle += m_sDbParams.m_omBusName;
    SetWindowText(omTitle.GetBuffer(MAX_PATH));

    if (m_sDbParams.m_eBus == J1939)
    {
        CMsgSignalDBWnd::sm_bValidJ1939Wnd = TRUE;
    }

    return m_bSplitWndCreated;
}
Beispiel #3
0
/*******************************************************************************
  Function Name  : OnVScroll
  Input(s)       : nSBCode, nPos, pScrollBar
  Output         : -
  Functionality  : Handles the Vertical scrolling event.
  Member of      : CRxMsgList
  Author(s)      : Arunkumar K
  Date Created   : 20-05-2010
  Modifications  : 
*******************************************************************************/
void CRxMsgList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	BOOL bInterpret = FALSE;
	::SendMessage( m_hParent, WM_GET_INTERPRET_STATE, (WPARAM)&bInterpret, 0);
	if ( bInterpret && theApp.pouGetFlagsPtr()->nGetFlagStatus( SENDMESG ) )
	{
		AfxBeginThread(UpDateThread, (LPVOID)this);					
		CFlickerFreeListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
		return;
	}    
	::SendMessage( m_hParent, WM_UPDATE_TREE_ITEMS_POS, 0, 0);		
    RedrawWindow();		
    CFlickerFreeListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
}
Beispiel #4
0
/*******************************************************************************
  Function Name  : vGetWinStatus
  Input(s)       : -
  Output         : -
  Functionality  : This function will update window postion from configuration
                   module. This function will use m_eWindowIdentity member to
                   denote window type.
  Member of      : CMDIChildBase
  Author(s)      : Raja N
  Date Created   : 18.4.2005
  Modifications  : 
*******************************************************************************/
void CMDIChildBase::vGetWinStatus()
{
#if 0
    // Create pointer to member so that configuraiton module will fill data
    WINDOWPLACEMENT * pDetails = &m_sWindowPlacement;
    // Get data from the configuration module
    theApp.bGetData(m_eWindowIdentity, (void**)&pDetails);
    // Add this flag as this is required to restore minimised window postion
    // also. Refer WINDOWPLACEMENT Structure help from MSDN
    m_sWindowPlacement.flags |= WPF_SETMINPOSITION;
    // Check for initial condition
    if( m_sWindowPlacement.rcNormalPosition.bottom == -1 ||
        m_sWindowPlacement.rcNormalPosition.top == -1 ||
        m_sWindowPlacement.rcNormalPosition.left == -1 ||
        m_sWindowPlacement.rcNormalPosition.right == -1 )
    {
        // Get Propotionate Initial value from Config Module
        theApp.bGetDefaultValue( m_eWindowIdentity, m_sWindowPlacement );
        // Update Config Module to update Window position value
        theApp.bSetData( m_eWindowIdentity, (void*)&m_sWindowPlacement);
    }
#endif
}
/******************************************************************************
 Function Name  : vGetWinStatus
 Input(s)       : sWinCurrStatus - A reference to (system defined)
                  WINDOWPLACEMENT structure to contain previous display
                  status of this window to be retrieved from the registry
 Output         : -
 Functionality  : This function is called to get the display status of window
                  stored
 Member of      : CMessageInterpretation
 Friend of      :    -
 Author(s)      : Raja N
 Date Created   : 05.04.2004
 Modifications  : Raja N on 18.04.2005, Modified to refer new window placement
                  identity - CRH0030
******************************************************************************/
void CMessageInterpretation::vGetWinStatus()
{
#if 0
    // Get window postion details from the configuration file
    WINDOWPLACEMENT* pDetails = &m_sWinCurrStatus;
    // Get data from the configuration module
    theApp.bGetData(MSGINTERP_WND_PLACEMENT, (void**)&pDetails);
    // Add this flag as this is required to restore minimised window postion
    // also. Refer WINDOWPLACEMENT Structure help from MSDN
    m_sWinCurrStatus.flags |= WPF_SETMINPOSITION;

    // Check for initial condition
    if( m_sWinCurrStatus.rcNormalPosition.bottom == -1 ||
            m_sWinCurrStatus.rcNormalPosition.top == -1 ||
            m_sWinCurrStatus.rcNormalPosition.left == -1 ||
            m_sWinCurrStatus.rcNormalPosition.right == -1 )
    {
        // Get Propotionate Initial value from Config Module
        theApp.bGetDefaultValue( MSGINTERP_WND_PLACEMENT, m_sWinCurrStatus );
        // Update Config Module to update Window position value
        theApp.bSetData( MSGINTERP_WND_PLACEMENT, (void*)&m_sWinCurrStatus);
    }
#endif
}
Beispiel #6
0
BOOL CNotificWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
    //Creation of the listbox window
    CRect omRect;
    this->GetClientRect(omRect);
    m_omListBox.Create(WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL
                       |LBS_HASSTRINGS |LBS_NOTIFY | LBS_WANTKEYBOARDINPUT |
                       LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL,
                       omRect, this, IDC_LSTB_OUTPUT);
    // Set the window icon
    SetIcon(theApp.LoadIcon(IDI_ICO_WRITE), TRUE);

    m_unTimer = SetTimer(0x50, 100, NULL);

    return CMDIChildBase::OnCreateClient(lpcs, pContext);
}
Beispiel #7
0
void CMsgSignalDBWnd::OnClose()
{
    // Get active frame
    CMainFrame* pFrame =
        static_cast<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 )
            {
                (*ppTempMsgSg)->
                bWriteIntoDatabaseFileFromDataStructure(
                    m_sDbParams.m_omDBPath );

                if ((*ppTempMsgSg)->bGetDBAcitveFlagStatus() == TRUE)
                {
                    pFrame->vPostMsgToSendMsgDlg(m_sDbParams.m_eBus);
                }

                // Check if the modified file is being loaded or not.
                //If yes then prompt the user whether he wants to
                //import it or not.
                CStringArray omImportedDBNames;
                CMsgSignal** m_ppsMSTemp = (CMsgSignal**)(m_sDbParams.m_ppvImportedDBs);

                if ((*m_ppsMSTemp) != NULL)
                {
                    (*m_ppsMSTemp)->vGetDataBaseNames(&omImportedDBNames);

                    for (INT nDBCount = 0; nDBCount < omImportedDBNames.GetSize();
                            nDBCount++)
                    {
                        if (m_sDbParams.m_omDBPath ==
                                omImportedDBNames.GetAt(nDBCount))
                        {
                            CString omText;
                            omText.Format( _T("File  \"%s\"  has been modified which is currently being loaded.\nDo you want to re-import it to reflect the changes?"),
                                           m_sDbParams.m_omDBPath);

                            if (MessageBox(omText, "", MB_ICONQUESTION | MB_YESNO) == IDYES)
                            {
                                switch (m_sDbParams.m_eBus)
                                {
                                    case CAN:
                                    {
                                        pFrame->dLoadDataBaseFile(m_sDbParams.m_omDBPath, FALSE);
                                    }
                                    break;

                                    case J1939:
                                    {
                                        pFrame->dLoadJ1939DBFile(m_sDbParams.m_omDBPath, FALSE);
                                    }
                                    break;
                                };
                            }
                        }
                    }
                }

                //Checking ends

                // Set the modified flag as saved
                if (NULL != (*ppTempMsgSg))
                {
                    (*ppTempMsgSg)->vSetModifiedFlag(TRUE);
                }
            }
            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();
    }
}
Beispiel #8
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();
    }
}
Beispiel #9
0
VOID CFlags::vSetFlagStatus(eCANMONITORFLAG eWhichFlag, INT nValue)
{
    m_omCriticalSec.Lock();

    switch( eWhichFlag )
    {
        case LOGTODISPLAY:
            m_bLogToWindow = nValue;
            break;

        case LOGTOFILE:
        {
            if (m_bLogEnable != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bLogEnable    = nValue ;
        }
        break;

        case LOGTOFILE_LIN:
        {
            if (m_bLogEnable != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bLogEnable    = nValue ;
        }
        break;

        case REPLAYMODE:
            m_wReplayMode = (WORD)nValue ;
            break;

        case REPLAYFILESELECTED:
            m_bReplayFileSelected = nValue;
            break;

        case LOGFILTER:
            if ( m_bLogFilterOn  != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_bLogFilterOn  = nValue ;
            break;
        case LOGFILTER_LIN:
            if ( m_bLogFilterOnLIN  != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_bLogFilterOnLIN  = nValue ;
            break;
        case DISPLAYFILTERON :
            if ( m_bDisplayFilterOn != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bDisplayFilterOn = nValue;
            break;
        case DISPLAYFILTERONLIN :
            if ( m_bDisplayFilterOnLin != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bDisplayFilterOnLin = nValue;
            break;
        case TRANSLATIONMODE :
            if ( m_bTranslationMode != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bTranslationMode = nValue;
            break;
        case FILTERUNDEFINEDMSGS :
            m_bFilterUndefinedMsgs = nValue;
            break;
        case RXMSG :
            m_bRxMsg = nValue;
            break;
        case SELECTDATABASEFILE :
            m_bSelectDatabaseFile = nValue ;
            break;
        case DLLLOADED :
            m_bDllLoaded = nValue;
            break;
        case TIMERBUTTON :
            m_bTimerButtonOn = nValue;
            break;
        case MSGHANDLERBUTTON :
            m_bMsgHandlerOn = nValue;
            break;
        case FUNCEDITOR :
            m_bFunctionEditorOn = nValue;
            break;
        case FILTERTXMSGS :
            m_bFilterTxMsg = nValue;
            break;
        case DBOPEN :
            m_bDbOpen = nValue;
            break;
        case DBOPEN_J1939 :
            m_bDbOpenJ1939 = nValue;
            break;
        case HEX :
            if ( m_bDisplayHexON != nValue)
            {
                theApp.vSetConfigurationModified();
            }
            m_bDisplayHexON = nValue;
            break;
        case DISPLAYTIMEMODE:
            if ( static_cast<INT>(m_wDisplayTimeMode) != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_wDisplayTimeMode = static_cast<WORD>(nValue);
            break;
        case SCROLLING :
            // Update if there is a change
            if( m_bScrolling != nValue )
            {
                m_bScrolling = nValue;
                // Set the modification flag to true
                theApp.vSetConfigurationModified();
            }
            break;

        case SENDMESG:
            m_bMessageSelected = nValue;
            break;

        case SENDMESGLIN:
            m_bMessageSelectedLin = nValue;
            break;

        case OVERWRITE:
            if ( m_bOverwriteEnable != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_bOverwriteEnable = nValue;
            break;

        case TIME_DELAY_REPLAY_FILE:
            m_bTimeDelayReplayFile = nValue;
            break;

        case PASS_STOP_FILTER:
            m_bStopFilter = nValue;
            break;

        case CONNECTED:
            m_bConnected = nValue;
            break;

        case LIN_CONNECTED:
            m_bConnectedLin = nValue;
            break;

        case KEY_HANDLER_ON:
            m_bKeyHandlerOn = nValue;
            break;

        case ERROR_HANDLER:
            m_bErrorHandlerOn = nValue;
            break;

        case DLL_HANDLER:
            m_bDLLHandlerOn = nValue;
            break;

        case ALL_HANDLER:
            m_bALLHandler = nValue;
            break;

        case CONTROLLER_MODE:
            m_wControllerMode = static_cast<WORD>(nValue);
            break;

        case PARALLEL_PORT_EPP:
            m_bParallelPortEPP = nValue;
            break;

        case LOGHEXON:
            if (m_bLogHexON != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_bLogHexON = nValue;
            break;
        case LOGTIMEMODE:
            if ( static_cast<WORD>(m_wLogTimeMode) != nValue )
            {
                theApp.vSetConfigurationModified();
            }
            m_wLogTimeMode = static_cast<WORD>(nValue);
            break;

        case eLOGOVERWRITEMODEON:
            m_bLogOverWriteON = nValue;
            break;

        case eLOGREPLAYMSGTYPE:
            m_nReplayMsgType = nValue;
            break;

        case SEND_SIGNAL_MSG:
            m_bSendSignalMSg = nValue;
            break;

        case ACTIVATED_J1939:
            m_bActivatedJ1939 = (BOOL) nValue;
            break;

        case REPLAYFILTER:
            m_bReplayFilter = nValue;
            break;
        case FLEXRAYSENDMSG:
            m_bFlexRaySendMsg = nValue;
            break;
        case ADRESSCLAIM_J1939:
            m_bJAddressClaimed = nValue;
            break;
        default:
            ASSERT(FALSE); // Invalid flag enum value
    }
    m_omCriticalSec.Unlock();
}
Beispiel #10
0
BOOL CCANMonitorApp::InitInstance()
{
    // Begin of Multiple Language support
    if ( CMultiLanguage::m_nLocales <= 0 )    // Not detected yet
    {
        CMultiLanguage::DetectLangID(); // Detect language as user locale
        CMultiLanguage::DetectUILanguage();    // Detect language in MUI OS
    }
    TCHAR szModuleFileName[MAX_PATH];        // Get Module File Name and path
    int ret = ::GetModuleFileName(theApp.m_hInstance, szModuleFileName, MAX_PATH);
    if ( ret == 0 || ret == MAX_PATH )
    {
        ASSERT(false);
    }
    // Load resource-only language DLL. It will use the languages
    // detected above, take first available language,
    // or you can specify another language as second parameter to
    // LoadLangResourceDLL. And try that first.
    ghLangInst = CMultiLanguage::LoadLangResourceDLL( szModuleFileName );
    if (ghLangInst)
    {
        AfxSetResourceHandle( ghLangInst );
    }
    // End of Multiple Language support

	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

    //InitCommonControls();
    // START CHANGES MADE FOR AUTOMATION
	CWinAppEx::InitInstance();

    // Initialize OLE libraries
    if (!AfxOleInit())
    {
        AfxMessageBox(_("Fail to Intilaize OLE"));
        return FALSE;
    }
    //CoInitializeEx(nullptr, COINIT_MULTITHREADED );

    CBusmasterDump dump("BUSMASTER");
    // END CHANGES MADE FOR AUTOMATION
    // Enable OLE/ActiveX objects support
    AfxEnableControlContainer();
	InitContextMenuManager();
	InitKeyboardManager();
	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need. DEBUG
//#ifdef _AFXDLL
//    Enable3dControls();         // Call this when using MFC in a shared DLL
//#else
//    Enable3dControlsStatic();   // Call this when linking to MFC statically
//#endif
    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey("RBEI-ETAS\\BUSMASTER_v3.1.0");
    // START CHANGES MADE FOR AUTOMATION
    COleTemplateServer::RegisterAll();
    // END CHANGES MADE FOR AUTOMATION
    //LoadStdProfileSettings(0); // Load standard INI file options (including MRU)
    // Enable drag/drop open
    // Enable DDE Execute open
    //EnableShellOpen();
    //RegisterShellFileTypes(TRUE);
    // Display splash screen
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    short shRegServer = -1;
    short shUnRegServer = -1;

    if (__argc > 1)
    {
        shRegServer = (short) strcmpi(__targv[1],"/regserver");
        shUnRegServer = (short) strcmpi(__targv[1],"/unregserver");
    }

    // Don't display a new MDI child window during startup
    if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew
            || cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen)
    {
        cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
    }

    // START CHANGES MADE FOR AUTOMATION

    if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
    {
        m_bFromAutomation = TRUE;
        //      return TRUE;
    }
    else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
    {
        AfxOleUnregisterTypeLib(LIBID_CAN_MonitorApp);
    }
    else
    {
        COleObjectFactory::UpdateRegistryAll();
        AfxOleRegisterTypeLib(AfxGetInstanceHandle(), LIBID_CAN_MonitorApp);
    }

    if (  shRegServer == 0  || shUnRegServer == 0 ) //If command line argument match
    {
        return FALSE;
    }

    if (!m_bFromAutomation)
    {
        CSplashScreen::ActivateSplashScreen(cmdInfo.m_bShowSplash);
    }

    // Allocate memory for CFlags
    m_pouFlags = &(CFlags::ouGetFlagObj());
    // create main MDI Frame window
    CMainFrame* pMainFrame = new CMainFrame;

    if ( pMainFrame == nullptr )
    {
        ::PostQuitMessage(0);
        return FALSE;
    }

    if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
    {
        return FALSE;
    }

    m_pMainWnd = pMainFrame;

    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    {
        return FALSE;
    }

    m_pMainWnd->DragAcceptFiles();
    // show main frame
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();
    //// Create message window



    if(m_pouMsgSgInactive == nullptr )
    {
        if(m_bFromAutomation==FALSE)
            MessageBox(nullptr,_(MSG_MEMORY_CONSTRAINT),
                       "BUSMASTER", MB_OK|MB_ICONINFORMATION);

        ::PostQuitMessage(0);
    }

    BOOL bResult;
    bResult = m_aomState[UI_THREAD].SetEvent();
    // get the information of the last used configuration file..
    // initialize the flag that indicates if the configuratin file has been
    // loaded..
    m_bIsConfigFileLoaded = FALSE;
    CString ostrCfgFilename = "";

    // If user has double click the .cfg file then assign that file name else
    // read from registry.
    if(cmdInfo.m_strFileName.IsEmpty() == TRUE)
    {
        //ostrCfgFilename =
        //    GetProfileString(_(SECTION), defCONFIGFILENAME, "");
        DWORD dwVal;
        bReadFromRegistry(HKEY_CURRENT_USER, _(SECTION), defCONFIGFILENAME, REG_SZ, ostrCfgFilename, dwVal);
    }
    else
    {
        ostrCfgFilename = cmdInfo.m_strFileName;
    }

    BOOL bValidDir = TRUE;
    CFileFind findFile;
    if (!ostrCfgFilename.IsEmpty() && !findFile.FindFile(ostrCfgFilename))
    {
        DWORD dwErr = GetLastError();
        CString strMsg = "";
        if (dwErr == ERROR_PATH_NOT_FOUND)
        {
            bValidDir = FALSE;
            FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, dwErr, 0, strMsg.GetBuffer(1024), 1024, nullptr);
            AfxMessageBox(strMsg);
        }
    }
    if(ostrCfgFilename.IsEmpty() == FALSE && bValidDir == TRUE)
    {
        bInitialiseConfiguration(m_bFromAutomation);

        // load the configuration information
        if(pMainFrame->nLoadConfigFile(ostrCfgFilename) != defCONFIG_FILE_SUCCESS)
        {
            //m_oConfigDetails.vInitDefaultValues();
            m_ostrConfigFilename = "";
        }
        else
        {
            m_ostrConfigFilename = ostrCfgFilename;
        }

        m_bIsConfigFileLoaded = TRUE;

        //build all nodes -- Node Simulation.
        pMainFrame->BuildAllNodes();

    }
    else
    {
        BOOL bReturn = bInitialiseConfiguration(m_bFromAutomation);

        if(bReturn == FALSE )
        {
            ::PostQuitMessage(0);
        }

        // Load a default database file
        //CStringArray omDatabaseArray;
        //CString omSampleDatabasePath;
        //omSampleDatabasePath.Format("%s\\Samples\\SampleDB.dbf",m_acApplicationDirectory);
        //DWORD dRetVal = pMainFrame->dLoadDataBaseFile(omSampleDatabasePath, FALSE);

        //if (dRetVal == S_OK)
        //{
        //    //omDatabaseArray.Add(omSampleDatabasePath);
        //    //Store in configdetails
        //    //bSetData(DATABASE_FILE_NAME, &omDatabaseArray);
        //    bWriteIntoTraceWnd(_(MSG_DEFAULT_DATABASE));
        //    bWriteIntoTraceWnd(_(MSG_CREATE_UNLOAD_DATABASE));
        //}
        pMainFrame->OnHex_DecButon();           // setting HEX by default
    }

    // ********  Filter workaround  ********
    // Filter list is initialised before msg wnd creation. So update display
    // filter here
    // Update Message Display Filter List
    //::PostThreadMessage(GUI_dwThread_MsgDisp, TM_UPDATE_FILTERLIST, nullptr, nullptr );
    // ********  Filter workaround  ********

    // Start Logging if is enabled
    // Get the Flag Pointer
    CFlags* pomFlag =  pouGetFlagsPtr();

    if( pomFlag != nullptr )
    {
        // Get the Logging Status
        BOOL bLogON = pomFlag->nGetFlagStatus(LOGTOFILE);

        // If it is on then post a message to display thread to start logging
        if(bLogON == TRUE )
        {
            // Start Logging
            //CLogManager::ouGetLogManager().vStartStopLogging( TRUE );
        }
    }
    //pMainFrame->OnHex_DecButon();           // setting HEX by default
    //CExecuteManager::ouGetExecuteManager().vStartDllReadThread();
    return TRUE;
}
/******************************************************************************
  Function Name    :  OnBnClickedCbtnDissociate

  Input(s)         :
  Output           :
  Functionality    :  Call the functions to remove the selected Databases
  Member of        :  CDatabaseDissociateDlg
  Friend of        :      -

  Author(s)        :  Anish Kumar
  Date Created     :  06.12.2006
  Modifications    :
******************************************************************************/
void CDatabaseDissociateDlg::OnBnClickedCbtnDissociate()
{
    //TO store the path of files dissociated
    CStringArray aomStrFilesDissociated;
    CMainFrame* pMainFrame = static_cast<CMainFrame*> (theApp.m_pMainWnd);
    // Get the indexes of all the selected items.
    int nCount = m_omDissociateDbLst.GetSelCount();

    if ( nullptr == pMainFrame )
    {
        return;
    }
    if(nCount > 0)
    {
        // Array of selected item's position
        CArray<int,int> aomListBoxSel;
        aomListBoxSel.SetSize(nCount);
        //Pass the array pointer to get the selected item's positions
        m_omDissociateDbLst.GetSelItems(nCount, aomListBoxSel.GetData());
        aomStrFilesDissociated.RemoveAll();

        for(int nTempCnt = 0 ; nTempCnt < nCount ; nTempCnt++)
        {
            BOOL bDBDeleted = FALSE;
            CString omstrDBPath ;
            //Selected file's index
            int nSelectedPos = aomListBoxSel.GetAt(nTempCnt);
            //Find the length of string to pass the buffer to have the selected File path
            int nBufferSize = m_omDissociateDbLst.GetTextLen(nSelectedPos);
            m_omDissociateDbLst.GetText(nSelectedPos,omstrDBPath.GetBuffer(nBufferSize));
            bDBDeleted = (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->bDeAllocateMemory(omstrDBPath.GetBuffer(0));

            if(TRUE == bDBDeleted)
            {
                aomStrFilesDissociated.Add(omstrDBPath.GetBuffer(0));
            }
        }

        //To remove from theApp class
        CStringArray aomstrDBFiles;
        (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vGetDataBaseNames(&aomstrDBFiles);
        //Delete the file path from the List box
        int nTotalCount = aomStrFilesDissociated.GetSize();
        CString omStrTempFile;

        for(int nCount=0 ; nCount<nTotalCount ; nCount++)
        {
            omStrTempFile = aomStrFilesDissociated.GetAt(nCount);
            int nIndex = 0;

            if( (nIndex = m_omDissociateDbLst.FindString(0,
                          omStrTempFile)) != LB_ERR )
            {
                //Delete the file path from the list box
                m_omDissociateDbLst.DeleteString(nIndex);
                int nStoredFile = aomstrDBFiles.GetSize();
                CString omStrTemp;
                BOOL bRemoved = FALSE;

                for(int nTemp = 0 ; nTemp < nStoredFile && bRemoved != TRUE; nTemp++)
                {
                    omStrTemp = aomstrDBFiles.GetAt(nTemp);

                    if(!(omStrTemp.Compare(omStrTempFile)))
                    {
                        aomstrDBFiles.RemoveAt(nTemp);
                        bRemoved = TRUE;
                    }
                }
            }
        }

        //Set the new file name array
        (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vSetDataBaseNames(&aomstrDBFiles);
        // Send a message to Tx Window about database change
        if( pMainFrame != nullptr)
        {
            eUSERSELCTION eUserSel = eDATABASEIMPORTCMD;
            pMainFrame->m_objTxHandler.vPostMessageToTxWnd(WM_USER_CMD, (WPARAM)eUserSel,0);
        }
        ////Delete Signal watch list and Graph window list
        //// Check for Signal Watch & DLL load Condition
        //
        BOOL bUserOption = FALSE;
        if(pMainFrame->m_psSignalWatchList != nullptr)
        {
            if(theApp.m_bFromAutomation == FALSE)
                bUserOption = AfxMessageBox(_(defIMPORT_WARNING),
                                            MB_YESNO | MB_DEFBUTTON1 | MB_ICONQUESTION) ==
                              IDYES;
            // If user wants to clear
            if(bUserOption == TRUE )
            {
                // Clear Signal Watch List
                pMainFrame->vUpdateSWList();
            }
        }
        //Added by Arun to update Data Handler Main entry list.
        pMainFrame->vUpdateMainEntryListInWaveDataHandler();
        pMainFrame->vClearSignalInfoList();
        if(!pMainFrame->m_ouWaveTransmitter.bIsBlockEnabled())
        {
            theApp.pouGetFlagsPtr()->vSetFlagStatus( SEND_SIGNAL_MSG, FALSE );
        }

        //Update Message windows
        pMainFrame->vUpdateAllMsgWndInterpretStatus(m_sDbParams.m_eBus, FALSE);

        // Check for Graph list
        for(register int nBusID = CAN; nBusID < AVAILABLE_PROTOCOLS; nBusID++)
        {
            if( pMainFrame->m_odGraphList[nBusID].m_omElementList.GetSize() > 0 )
            {
                // Get the delete confirmation from the user
                if(theApp.m_bFromAutomation == FALSE)
                    bUserOption = AfxMessageBox(_(defIMPORT_WARNING_GRAPH),
                                                MB_YESNO | MB_DEFBUTTON1 | MB_ICONQUESTION) ==
                                  IDYES;

                // If user wants to clear
                if(bUserOption == TRUE )
                {
                    // Clear Graph List for all buses.
                    for(register int nID = CAN; nID < AVAILABLE_PROTOCOLS; nID++)
                    {
                        pMainFrame->m_odGraphList[nID].m_omElementList.RemoveAll();
                    }

                    // Send the Message to the Left View to Update List for all buses
                    if( pMainFrame != nullptr )
                    {
                        pMainFrame->vPostConfigChangeCmdToSigGrphWnds(FALSE);
                    }
                }
                break;
            }
        }
    }
}