serverstart/src/serverstartdlg.cpp
//--------------------------------------------------------------------------------
// This callback will run when the user changed the name of the preference file.
// We will need to read data from the new preference file and fill all edit fields
// with this data.
//--------------------------------------------------------------------------------
This callback will run when the user changed the name of the preference file.
We will need to read data from the new preference file and fill all edit fields
with this data.
This callback will run when the user changed the name of the preference file . We will need to read data from the new preference file and fill all edit fields with this data .
void CServerStartDlg::OnBrowsePrefs()  {
CFileDialog openDlg(TRUE,"prefs","default",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
					"Discover Settings (*.prefs) |*.prefs||",
					this);
CString name;
   if(openDlg.DoModal()==IDOK) {
	   if(m_SaveButton.IsWindowEnabled()==TRUE) {
		   if(MessageBox("You have made changes in the service settings.\n Would you like to save them?","Service Settings",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) {
			   SavePrefs(m_PrefsFile);
		   }
	   }
	   name=openDlg.GetPathName();
	   m_PrefsEdit.SetWindowText(name);
	   m_NameEditor.SetWindowText(name);
	   LoadPrefs(name);
	   m_PrefsFile=name;
	   m_NameEditor.SetWindowText(name);
       m_SaveButton.EnableWindow(FALSE);	
	   m_PathChanged = FALSE;
   }
}
void CServerStartDlg :: OnBrowsePrefs ( ) { CFileDialog openDlg ( TRUE , " " , " " , OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , " " , this ) ; CString name ; if ( openDlg . DoModal ( ) == IDOK ) { if ( m_SaveButton . IsWindowEnabled ( ) == TRUE ) { if ( MessageBox ( " \n " , " " , MB_YESNO | MB_ICONEXCLAMATION ) == IDYES ) { SavePrefs ( m_PrefsFile ) ; } } name = openDlg . GetPathName ( ) ; m_PrefsEdit . SetWindowText ( name ) ; m_NameEditor . SetWindowText ( name ) ; LoadPrefs ( name ) ; m_PrefsFile = name ; m_NameEditor . SetWindowText ( name ) ; m_SaveButton . EnableWindow ( FALSE ) ; m_PathChanged = FALSE ; } }
This callback will run when the user changed the name of the preference file.
This callback will run when the user changed the name of the preference file .
// Loading the data from the *.prefs file