void CuDlgMain::OnDropdownComboNode2() { try { CString strNode = _T("(local)"); QueryNode(&m_cComboNode2, strNode); } catch (CeNodeException e) { SetForegroundWindow(); BOOL bStarted = INGRESII_IsRunning(); if (!bStarted) AfxMessageBox (IDS_MSG_INGRES_NOT_START); else AfxMessageBox (e.GetReason()); } catch(...) { } }
void CuVcdaCtrl::RestoreInstallation() { try { BOOL bRun = INGRESII_IsRunning(); if (bRun) { // // The restore operation cannot be performed while Ingres is running. AfxMessageBox (IDS_MSG_CANNOTRESTORExINGRESRUNNING); return; } if (!m_pDlgMain->IsWindowVisible() || !m_bComparedCurrInstall) { AfxMessageBox (IDS_MSG_COMPARE_BEFORE); return; } m_pDlgMain->OnRestore(); } catch (...) { } }
BOOL CaIjaTreeData::RefreshData(CTreeCtrl* pTree, HTREEITEM hItem, CaRefreshTreeInfo* pInfo) { BOOL bError = FALSE; CTypedPtrList<CObList, CaIjaTreeItemData*> listNode; try { // // Refresh only the branch has already been expanded: if (!GetTreeCtrlData().IsAlreadyExpanded()) return TRUE; if (!IJA_QueryNode (listNode)) return FALSE; } catch (CeSqlException e) { if (!INGRESII_IsRunning()) { CString strMsg; strMsg.LoadString(IDS_INGRES_NOT_RUNNING); AfxMessageBox (strMsg); } else AfxMessageBox (e.GetReason()); bError = TRUE; } catch (...) { AfxMessageBox (_T("System error::IJA_QueryNode, failed to query nodes.")); bError = TRUE; } if (bError) { CString csItem; csItem.LoadString(IDS_DATA_UNAVAILABLE); m_EmptyNode.SetItem(csItem); if (pTree && hItem) Display (pTree, NULL); return FALSE; } CfMainFrame* pm = (CfMainFrame*)theApp.m_pMainWnd; ASSERT (pm); if (!pm) return FALSE; CvViewRight* pV = (CvViewRight*)pm->GetRightView(); ASSERT (pV); if (!pV) return FALSE; BOOL bAddNode = FALSE; if (pV->m_pCtrl && IsWindow (pV->m_pCtrl->m_hWnd)) { pV->m_pCtrl->CleanNode(); bAddNode = TRUE; } // // Mark all old Node to be deleted: POSITION pos = m_listNode.GetHeadPosition(); while (pos != NULL) { CaIjaTreeItemData* pItem = m_listNode.GetNext (pos); pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_DELETE); } // // Add new Node: pos = listNode.GetHeadPosition(); while (pos != NULL) { CaIjaTreeItemData* pItem = listNode.GetNext (pos); CaIjaTreeItemData* pExist = IJA_FindItem (m_listNode, pItem); if (pExist) { pExist->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_EXIST); delete pItem; continue; } pItem->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_NEW); m_listNode.AddTail (pItem); } if (pInfo->m_nLevel == 1 || pInfo->m_nLevel == -1) { pos = m_listNode.GetHeadPosition(); while (pos != NULL) { CaIjaTreeItemData* pItem = m_listNode.GetNext (pos); if (pItem->GetTreeCtrlData().GetState () == CaTreeCtrlData::ITEM_DELETE) continue; CaRefreshTreeInfo info; if (pInfo->m_nLevel == 1) info.SetInfo (0); else info.SetInfo (-1); pItem->RefreshData (NULL, NULL, &info); } } // // Update display of all nodes: if (pTree && hItem) Display (pTree, NULL); if (bAddNode) { pos = m_listNode.GetHeadPosition(); while (pos != NULL) { CaIjaTreeItemData* pItem = m_listNode.GetNext (pos); pV->m_pCtrl->AddNode(pItem->GetItem()); } } return TRUE; }
BOOL CappVsda::InitInstance() { AfxEnableControlContainer(); // 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. /* No need in .NET #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif */ INGRESII_llSetPasswordPrompt(); // // Check the if ingres is running: TCHAR* pEnv; pEnv = _tgetenv(_T("II_SYSTEM")); if (!pEnv) { AfxMessageBox (IDS_MSG_II_SYSTEM_NOT_DEFINED); return FALSE; } CString strCmd = pEnv; strCmd += consttchszIngBin; strCmd += consttchszWinstart; CaIngresRunning ingStart (NULL, strCmd, IDS_MSG_REQUEST_TO_START_INSTALLATION, AFX_IDS_APP_TITLE); long nStart = INGRESII_IsRunning(ingStart); switch (nStart) { case 0: // not started break;; case 1: // started break; case 2: // failed to started AfxMessageBox (IDS_MSG_INGRES_START_FAILED); return FALSE; default: break; } // 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(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) #if !defined (_DEBUG) if (!LIBGUIDS_IsCLSIDRegistered(_T("{CC2DA2B6-B8F1-11D6-87D8-00C04F1F754A}"))) { CString strMsg; BOOL bOK = TRUE; int nRes = LIBGUIDS_RegisterServer (_T("vsda.ocx"), NULL); switch (nRes) { case 2: //_T("II_SYSTEM is not defined"); strMsg.LoadString (IDS_MSG_II_SYSTEM_NOT_DEFINED); AfxMessageBox (strMsg, MB_ICONSTOP|MB_OK); return FALSE; case 1: AfxFormatString1(strMsg, IDS_MSG_FAILED_2_REGISTER_SERVER, _T("vsda.ocx")); AfxMessageBox (strMsg, MB_ICONSTOP|MB_OK); return FALSE; case 0: // Success: break; } } #endif m_sessionManager.SetDescription(_T("Ingres Visual Database Objects Differences Analyzer")); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CdSda), RUNTIME_CLASS(CfSda), // main SDI frame window RUNTIME_CLASS(CvSda)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }