serverstart/src/serverstartdlg.cpp
//--------------------------------------------------------------------------------
// If the user changed the name of the preference file we need to ask him to save
// changes, if any, in the old preference file.
//--------------------------------------------------------------------------------
If the user changed the name of the preference file we need to ask him to save
changes, if any, in the old preference file.
If the user changed the name of the preference file we need to ask him to save changes if any in the old preference file .
void CServerStartDlg::OnPrefsEntered() {
CString prefsFile;
	if(m_PathChanged==TRUE) {
	    m_PrefsEdit.GetWindowText(prefsFile);
		prefsFile = Parse(prefsFile);
	    m_PrefsEdit.SetWindowText(prefsFile);
	    m_NameEditor.SetWindowText(prefsFile);
		CFile prefs;
		CFileException openEx;
		if(prefs.Open(prefsFile,CFile::modeRead|CFile::shareDenyNone,&openEx)==TRUE) {
			prefs.Close();
			m_PrefsFile = prefsFile;
            LoadPrefs(m_PrefsFile); 
		    m_SaveButton.EnableWindow(FALSE);	
		} else {
			TCHAR szError[1024];
			openEx.GetErrorMessage(szError, 1024);
			MessageBox(szError,"File opening error", MB_ICONSTOP | MB_OK);
			m_PrefsEdit.SetWindowText(m_PrefsFile);
	        m_NameEditor.SetWindowText(m_PrefsFile);
		}
		m_PathChanged = FALSE;
	}
}
void CServerStartDlg :: OnPrefsEntered ( ) { CString prefsFile ; if ( m_PathChanged == TRUE ) { m_PrefsEdit . GetWindowText ( prefsFile ) ; prefsFile = Parse ( prefsFile ) ; m_PrefsEdit . SetWindowText ( prefsFile ) ; m_NameEditor . SetWindowText ( prefsFile ) ; CFile prefs ; CFileException openEx ; if ( prefs . Open ( prefsFile , CFile :: modeRead | CFile :: shareDenyNone , & openEx ) == TRUE ) { prefs . Close ( ) ; m_PrefsFile = prefsFile ; LoadPrefs ( m_PrefsFile ) ; m_SaveButton . EnableWindow ( FALSE ) ; } else { TCHAR szError [ 1024 ] ; openEx . GetErrorMessage ( szError , 1024 ) ; MessageBox ( szError , " " , MB_ICONSTOP | MB_OK ) ; m_PrefsEdit . SetWindowText ( m_PrefsFile ) ; m_NameEditor . SetWindowText ( m_PrefsFile ) ; } m_PathChanged = FALSE ; } }
If the user changed the name of the preference file we need to ask him to save
changes, if any, in the old preference file.
If the user changed the name of the preference file we need to ask him to save changes if any in the old preference file .