serverstart/src/serverstartdlg.cpp
//--------------------------------------------------------------------------------
// This callback will run every time the user selected new service in the service 
// list. It will ping the service specified and will remove the service from the 
// list if it is dead. The currently selected service will be placed into 
// m_SelectedService member variable and will be used as a default service when
// starting the client.
//--------------------------------------------------------------------------------
This callback will run every time the user selected new service in the service
list. It will ping the service specified and will remove the service from the
list if it is dead. The currently selected service will be placed into
m_SelectedService member variable and will be used as a default service when
starting the client.
This callback will run every time the user selected new service in the service list . It will ping the service specified and will remove the service from the list if it is dead . The currently selected service will be placed into m_SelectedService member variable and will be used as a default service when starting the client .
void CServerStartDlg::OnServiceSelected()  {
CString service;
int i;
	int sel=m_ServiceList.GetCurSel();
	if(sel>=0) {
		m_ServiceList.GetText(sel,service);
	    int service_port;
	    int tcp_addr;
		HCURSOR save = SetCursor(LoadCursor(NULL, IDC_WAIT));
		for(i=0;i<10;i++) {
		   if(NameServerGetService(service,service_port,tcp_addr)==1) break;
		}
		SetCursor(save);
		if(i==10) {
		   AfxMessageBox("Selected service is no longer available\n and will be removed from the service list.");
		   m_SelectedService="";
           FillServiceList(m_ModeSelector.GetCurSel());	
		} else {
			m_SelectedService=service;
	        m_RemoveButton.EnableWindow(TRUE);
		}
	}
}
void CServerStartDlg :: OnServiceSelected ( ) { CString service ; int i ; int sel = m_ServiceList . GetCurSel ( ) ; if ( sel >= 0 ) { m_ServiceList . GetText ( sel , service ) ; int service_port ; int tcp_addr ; HCURSOR save = SetCursor ( LoadCursor ( NULL , IDC_WAIT ) ) ; for ( i = 0 ; i < 10 ; i ++ ) { if ( NameServerGetService ( service , service_port , tcp_addr ) == 1 ) break ; } SetCursor ( save ) ; if ( i == 10 ) { AfxMessageBox ( " \n " ) ; m_SelectedService = " " ; FillServiceList ( m_ModeSelector . GetCurSel ( ) ) ; } else { m_SelectedService = service ; m_RemoveButton . EnableWindow ( TRUE ) ; } } }
This callback will run every time the user selected new service in the service
list.
This callback will run every time the user selected new service in the service list .