Esempio n. 1
0
SHORT CIpmCtrl::GetConnected(LPCTSTR lpszNode, LPCTSTR lpszDatabase)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	if (DBACloseNodeSessions((LPUCHAR)lpszNode, TRUE,TRUE) != RES_SUCCESS)
		return 1;

	return 0;
}
Esempio n. 2
0
void CDlgDisconnServer::OnOK() 
{
  BOOL bFullDisconnect  = TRUE;

  CString csFullNodeName = BuildFullNodeName(m_pServerDataMin);

  // Replication monitoring special management
//  if (IsNodeUsed4ExtReplMon((LPUCHAR)(LPCTSTR)csFullNodeName,FALSE)) {
//    int ires = MessageBox("The current node is referenced by Windows monitoring replication on other nodes."
//                          "In addition to closing the opened windows on the current node,"
//                          "Do you want to perform a full disconnect breaking the references?",
//                          "Disconnect",
//                          MB_ICONQUESTION | MB_YESNOCANCEL);
//    switch (ires) {
//      case IDCANCEL:
//        CDialog::OnCancel();
//        return;
//      case IDYES:
//        bFullDisconnect = TRUE;
//        break;
//      case IDNO:
//        bFullDisconnect = FALSE;
//        break;
//    }
//  }


  int cpt;
  int count = m_windowslist.GetCount();
  ForgetDelayedUpdates();
  for (cpt = 0; cpt < count; cpt++) {
    HWND hWnd = (HWND)m_windowslist.GetItemData(cpt);
    CWnd *pWnd;
    pWnd = CWnd::FromHandlePermanent(hWnd);
    ASSERT (pWnd);
    CMDIChildWnd *pMdiChild = (CMDIChildWnd *)pWnd;
    pMdiChild->MDIDestroy();
  }
  AcceptDelayedUpdates();

  if (bFullDisconnect) {
    CWaitCursor hourglass;
    int hNode = GetVirtNodeHandle((LPUCHAR)(LPCTSTR)csFullNodeName);
//    CloseCachesExtReplicInfo((LPUCHAR)(LPCTSTR)csFullNodeName,FALSE);// not with /gw for instance
    FreeNodeStructsForName((LPUCHAR)(LPCTSTR)csFullNodeName,FALSE,TRUE);
    DBACloseNodeSessions  ((LPUCHAR)(LPCTSTR)csFullNodeName,FALSE,TRUE);
//    FreeNodeStruct (hNode,FALSE);
  }

	CDialog::OnOK();
}