BOOL CMcpApp::InitInstance() { CCmdLineParser strCmd; strCmd.SplitLine(GetCommandLine()); for (int i = 0; i < strCmd.m_SwitchArray.GetSize(); i++) { CString strSwt = strCmd.m_SwitchArray.GetAt(i); if(strSwt == "/session_id") { m_ulSid = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/client_wnd") { m_hClientWnd = (HWND)SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/cpid") { m_ulClientPluginId = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/ciid") { m_ulClientInstanceId = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/ciid") { m_ulClientInstanceId = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/disable_hdb") { m_bDisableHdb = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } else if(strSwt == "/cco_only") { m_bOnlyHdbCco = SOP_Str2U32(strCmd.m_ArgArray.GetAt(i)); } } if(m_ulSid == 0) { SOP_MessageBoxAutoTimeOut(NULL, _T("OK"), MB_ICONINFORMATION, 5, RGB(255,255,255), RGB(0,0,255), "This Application is launched by DBK ONLY!\nSession ID(0) is invalid\n"); return FALSE; } if(m_ulSid >= DBK_MCP_SESSION_ID_MAX) { SOP_MessageBoxAutoTimeOut(NULL, _T("OK"), MB_ICONINFORMATION, 5, RGB(255,255,255), RGB(0,0,255), "This Application is launched by DBK ONLY!\nSession ID(%d) is too large, should be less than %d", m_ulSid, DBK_MCP_SESSION_ID_MAX); return FALSE; } if(m_hClientWnd == 0) { SOP_MessageBoxAutoTimeOut(NULL, _T("OK"), MB_ICONINFORMATION, 5, RGB(255,255,255), RGB(0,0,255), "This Application is launched by DBK ONLY!\nClient HWND(0) is invalid"); return FALSE; } if(m_ulClientPluginId == 0) { SOP_MessageBoxAutoTimeOut(NULL, _T("OK"), MB_ICONINFORMATION, 5, RGB(255,255,255), RGB(0,0,255), "This Application is launched by DBK ONLY!\nPlugin ID(0) is invalid"); return FALSE; } if(m_ulClientInstanceId == 0) { SOP_MessageBoxAutoTimeOut(NULL, _T("OK"), MB_ICONINFORMATION, 5, RGB(255,255,255), RGB(0,0,255), "This Application is launched by DBK ONLY!\nInstance ID(0) is invalid"); return FALSE; } m_nCmdShow = SW_HIDE; InitSopModules(); // Standard initialization #if _MSC_VER < 1400 # ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL # else Enable3dControlsStatic(); // Call this when linking to MFC statically # endif #endif // Create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (pMainFrame == NULL) { return FALSE; } if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) { return FALSE; } m_pMainWnd = pMainFrame; // Enable adapter m_BaiDevAdpConnect.AdapterAttach(); // // The main window has been initialized, so show and update it. // pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); return TRUE; } int CMcpApp::ExitInstance() { m_BaiDevAdpConnect.AdapterDetach(); ExitSopModules(); // Exit the application main thread return CWinApp::ExitInstance(); } U32 CMcpApp::ConsoleIo(BOOL bOpen, BOOL bDefault) { if(bDefault) { CString strFileCfg; strFileCfg.Format("%s\\sop_mcp_console.cfg", CFilePath::GetAppPath()); if (SOP_IsFileExist(strFileCfg)) { bOpen = TRUE; } } if(bOpen) { if (!SOP_IsConsoleExist()) { SOP_ConsoleOpen(TRUE); SOP_SDMEVT(_T("SDM Console Start!\n")); } else { SOP_ConsoleOutputShow(TRUE); } } else { SOP_ConsoleOutputShow(FALSE); SOP_SDMEVT(_T("SDM Console Hide!\n")); } return ERR_SOP_SUCCESS; }