www.pudn.com > 6manager_server.rar > manager_clientDlg.cpp


// manager_clientDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "manager_client.h" 
#include "manager_clientDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
#include "ConnectDlg.h" 
#include "HelpDlg.h" 
///////////////////////////////////////////////////////////////////////////// 
// CAboutDlg dialog used for App About 
 
class CAboutDlg : public CDialog 
{ 
public: 
	CAboutDlg(); 
 
// Dialog Data 
	//{{AFX_DATA(CAboutDlg) 
	enum { IDD = IDD_ABOUTBOX }; 
	//}}AFX_DATA 
 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CAboutDlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	//{{AFX_MSG(CAboutDlg) 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) 
{ 
	//{{AFX_DATA_INIT(CAboutDlg) 
	//}}AFX_DATA_INIT 
} 
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAboutDlg) 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 
	//{{AFX_MSG_MAP(CAboutDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CManager_clientDlg dialog 
 
CManager_clientDlg::CManager_clientDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CManager_clientDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CManager_clientDlg) 
	m_socketinfo = _T(""); 
	m_output = _T(""); 
	m_edit_save1 = _T(""); 
	m_edit_save2 = _T(""); 
	m_edit_save4 = _T(""); 
	m_edit_save5 = _T(""); 
	m_edit_save6 = _T(""); 
	m_servername=_T(""); 
	m_portaddress=6060; 
	m_pSocket=NULL; 
	m_edit_save3 = _T(""); 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
} 
 
void CManager_clientDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CManager_clientDlg) 
	DDX_Text(pDX, IDC_INFORMATION, m_socketinfo); 
	DDX_Text(pDX, IDC_OUTPUT, m_output); 
	DDX_Text(pDX, IDC_EDIT_SAVE1, m_edit_save1); 
	DDX_Text(pDX, IDC_EDIT_SAVE2, m_edit_save2); 
	DDX_Text(pDX, IDC_EDIT_SAVE4, m_edit_save4); 
 
	DDX_Text(pDX, IDC_EDIT_SAVE3, m_edit_save3); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CManager_clientDlg, CDialog) 
	//{{AFX_MSG_MAP(CManager_clientDlg) 
	ON_WM_SYSCOMMAND() 
	ON_WM_PAINT() 
	ON_WM_QUERYDRAGICON() 
	ON_BN_CLICKED(IDC_BUTTON_REMOVE, OnButtonRemove) 
	ON_WM_TIMER() 
	ON_BN_CLICKED(IDC_BUTTON_SAVE1, OnButtonSave1) 
	ON_BN_CLICKED(IDC_BUTTON_SAVE2, OnButtonSave2) 
	ON_COMMAND(ID_RUN, OnRun) 
	ON_BN_CLICKED(IDC_BUTTON_SAVE3, OnButtonSave3) 
	ON_BN_CLICKED(IDC_BUTTON_SAVE4, OnButtonSave4) 
 
	ON_BN_CLICKED(IDC_BUTTON_SAVE6, OnButtonSave6) 
	ON_COMMAND(ID_RECEIVE_SUCCESS, OnReceiveSuccess) 
	ON_COMMAND(ID_SEND_SUCCESS, OnSendSuccess) 
	ON_COMMAND(ID_RECEIVE_NUMBER, OnReceiveNumber) 
	ON_COMMAND(ID_SEND_NUMBER, OnSendNumber) 
	ON_COMMAND(ID_FILE_SAVE, OnFileSave) 
	ON_COMMAND(ID_FILE_EXIT, OnFileExit) 
	ON_COMMAND(ID_VIEW_CONNECT, OnViewConnect) 
	ON_COMMAND(ID_VIEW_DISCONNECT, OnViewDisconnect) 
	ON_COMMAND(ID_VIEW_HELP, OnViewHelp) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CManager_clientDlg message handlers 
 
BOOL CManager_clientDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Add "About..." menu item to system menu. 
 
	// IDM_ABOUTBOX must be in the system command range. 
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 
	ASSERT(IDM_ABOUTBOX < 0xF000); 
 
	CMenu* pSysMenu = GetSystemMenu(FALSE); 
	if (pSysMenu != NULL) 
	{ 
		CString strAboutMenu; 
		strAboutMenu.LoadString(IDS_ABOUTBOX); 
		if (!strAboutMenu.IsEmpty()) 
		{ 
			pSysMenu->AppendMenu(MF_SEPARATOR); 
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 
		} 
	} 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	// TODO: Add extra initialization here 
	 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CManager_clientDlg::OnSysCommand(UINT nID, LPARAM lParam) 
{ 
	if ((nID & 0xFFF0) == IDM_ABOUTBOX) 
	{ 
		CAboutDlg dlgAbout; 
		dlgAbout.DoModal(); 
	} 
	else 
	{ 
		CDialog::OnSysCommand(nID, lParam); 
	} 
} 
 
// If you add a minimize button to your dialog, you will need the code below 
//  to draw the icon.  For MFC applications using the document/view model, 
//  this is automatically done for you by the framework. 
 
void CManager_clientDlg::OnPaint()  
{ 
	if (IsIconic()) 
	{ 
		CPaintDC dc(this); // device context for painting 
 
		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 
 
		// Center icon in client rectangle 
		int cxIcon = GetSystemMetrics(SM_CXICON); 
		int cyIcon = GetSystemMetrics(SM_CYICON); 
		CRect rect; 
		GetClientRect(&rect); 
		int x = (rect.Width() - cxIcon + 1) / 2; 
		int y = (rect.Height() - cyIcon + 1) / 2; 
 
		// Draw the icon 
		dc.DrawIcon(x, y, m_hIcon); 
	} 
	else 
	{ 
		CDialog::OnPaint(); 
	} 
} 
 
// The system calls this to obtain the cursor to display while the user drags 
//  the minimized window. 
HCURSOR CManager_clientDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
void CManager_clientDlg::enable_control(int state) 
{ 
	CWnd *control; 
	control=GetDlgItem(IDC_INFORMATION); 
	control->EnableWindow(state); 
	control=GetDlgItem(IDC_OUTPUT); 
	control->EnableWindow(state); 
} 
void CManager_clientDlg::GetScoketMsg(CClientUseSocket *pSocket) 
{ 
//	m_output=""; 
	BOOL MsgEnd=FALSE; 
//	CString Msg; 
	char MsgBuf[200000]; 
	int bufsize=2000; 
	do 
	{ 
		strcpy(MsgBuf,""); 
		int left=pSocket->Receive(MsgBuf,bufsize); 
		if(left<2000&&left>0)MsgEnd=TRUE; 
 
		MsgBuf[left]=0; 
//		Msg+=MsgBuf; 
		m_output+=MsgBuf; 
		 
 
	} 
	while(!MsgEnd); 
//	m_output=MsgBuf; 
	m_output+="\r\n\r\n"; 
	UpdateData(FALSE); 
	enable_control(TRUE); 
 
//	m_edit_save1=m_output; 
//	char buf[10]; 
//	sprintf(buf,"%s",m_edit_save1.GetBuffer(10)); 
//	MessageBox(buf,MB_OK); 
//	MessageBox(m_output,"客户程序rrrrrr"); 
 
 
 
} 
 
//===================辅助网络连接================== 
BOOL CManager_clientDlg::ConnectServer(CClientUseSocket *pSocket) 
{ 
	if(!(pSocket->Create())) 
	{ 
		delete pSocket; 
		pSocket=NULL; 
		MessageBox("socket创建失败","错误信息",MB_OK); 
		return FALSE; 
	} 
	if(!pSocket->Connect(m_servername,m_portaddress)) 
	{ 
		delete pSocket; 
		pSocket=NULL; 
		MessageBox("服务器连接失败","错误信息",MB_OK); 
		return FALSE; 
 
	} 
	return TRUE; 
} 
 
void CManager_clientDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	//m_output.Empty(); 
	//UpdateData(FALSE); 
	if(m_pSocket) 
	{ 
	 
		UpdateData(TRUE); 
//		CEdit  *info_edit,*oid_edit;//		//info_edit=(CEdit*)GetDlgItem(IDC_INFORMATION); 
//		oid_edit=(CEdit *)GetDlgItem(IDC_SOCKETOID);//		char info_buffer[10],oid_buffer[50]; 
//		info_edit->GetWindowText(info_buffer,10);//		oid_edit->GetWindowText(oid_buffer,50); 
//		char *ptr,*ptr2;//		ptr=info_buffer; 
//		ptr2=oid_buffer;//      Command cmd; 
//	    cmd.incmd=ptr;//		cmd.inoid=ptr2;//		//	m_pSocket->Send(&cmd,sizeof(cmd)); 
 
 
 
		m_pSocket->Send(LPCTSTR(m_socketinfo),m_socketinfo.GetLength()); 
	} 
	else 
		MessageBox("当前没有连接到服务器,无法发送!","客户端程序",MB_OK); 
	enable_control(FALSE); 
 
//	CWnd *control; 
//	control=GetDlgItem(IDC_INFORMATION); 
//	control->EnableWindow(FALSE); 
//	control=GetDlgItem(IDC_OUTPUT); 
//	control->EnableWindow(FALSE); 
//	SetTimer(100,500,NULL); 
 
	//CDialog::OnOK(); 
} 
 
 
//==========================清除内容======================== 
void CManager_clientDlg::OnButtonRemove()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	 
	m_output.Empty(); 
//	m_socketinfo.Empty(); 
	UpdateData(FALSE); 
	enable_control(TRUE); 
	 
} 
void CManager_clientDlg::OnTimer(UINT nIDEvent)  
{ 
	// TODO: Add your message handler code here and/or call default 
	KillTimer(nIDEvent); 
	CDialog::OnTimer(nIDEvent); 
} 
 
 
void CManager_clientDlg::OnButtonSave1()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save1=m_output; 
	UpdateData(FALSE); 
} 
 
void CManager_clientDlg::OnButtonSave2()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save2=m_output; 
	UpdateData(FALSE); 
} 
 
void CManager_clientDlg::OnRun()  
{ 
	// TODO: Add your command handler code here 
	UpdateData(TRUE); 
	char buf1[10]; 
	char buf2[10]; 
	sprintf(buf1,"%s",m_edit_save1.GetBuffer(10)); 
	sprintf(buf2,"%s",m_edit_save2.GetBuffer(10)); 
//	AfxMessageBox(buf1); 
	int ifadminstatus=atol(buf1); 
	int ifoperstatus=atol(buf2); 
//	AfxMessageBox(buf2); 
	if((ifadminstatus==1)&&(ifoperstatus==1)) 
		AfxMessageBox("接口使用正常",MB_OK|MB_ICONINFORMATION); 
	else if((ifadminstatus==2)&&(ifoperstatus==2)) 
		AfxMessageBox("接口已被关掉",MB_OK|MB_ICONINFORMATION); 
	else if((ifadminstatus==3)&&(ifoperstatus==3)) 
		AfxMessageBox("接口处于测试状态",MB_ICONINFORMATION|MB_OK); 
	else if((ifadminstatus==4)&&(ifoperstatus==2)) 
		AfxMessageBox("接口有故障",MB_OK|MB_ICONEXCLAMATION); 
	else 
		AfxMessageBox("不明状态",MB_OK|MB_ICONSTOP); 
} 
 
void CManager_clientDlg::OnButtonSave3()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save3=m_output; 
	UpdateData(FALSE); 
} 
 
void CManager_clientDlg::OnButtonSave4()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save4=m_output; 
	UpdateData(FALSE); 
} 
 
void CManager_clientDlg::OnButtonSave5()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save5=m_output; 
	UpdateData(FALSE); 
} 
 
void CManager_clientDlg::OnButtonSave6()  
{ 
	// TODO: Add your control notification handler code here 
	m_edit_save6=m_output; 
	UpdateData(FALSE); 
} 
 
//========================求成功接收量================ 
void CManager_clientDlg::OnReceiveNumber()  
{ 
	// TODO: Add your command handler code here 
	//接收的总包数=ifinucastpkts(oid=1.3.6.1.2.1.2.2.1.11.1)+ifinnucastpkts(oid=1.3.6.1.2.1.2.2.1.12.1) 
	//接收的丢弃数+接收的错误数=ifindiscards(1.3.6.1.2.1.2.2.1.13.1)+ifinerrors(1.3.6.1.2.1.2.2.1.14.1) 
	UpdateData(TRUE); 
	char buf1[20]; 
	char buf2[20]; 
	char buf3[20]; 
	char buf4[20]; 
	if(m_edit_save1.GetLength()==0||m_edit_save2.GetLength()==0|| 
		m_edit_save3.GetLength()==0||m_edit_save4.GetLength()==0) 
	{ 
		AfxMessageBox("请先获取数据,详细可以查看使用向导",MB_OK|MB_ICONSTOP); 
		return; 
	} 
	sprintf(buf1,"%s",m_edit_save1.GetBuffer(20)); 
	sprintf(buf2,"%s",m_edit_save2.GetBuffer(20)); 
	sprintf(buf3,"%s",m_edit_save3.GetBuffer(20)); 
	sprintf(buf4,"%s",m_edit_save4.GetBuffer(20)); 
    long int  ifinucastpkts=atol(buf1); 
	long int  ifinnucastpkts=atol(buf2); 
	long int  ifindiscards=atol(buf3); 
	long int  ifinerrors=atol(buf4); 
	long int  cgl=(ifinucastpkts+ifinnucastpkts-ifindiscards-ifinerrors); 
	//float fcgl=(float)cgl; 
	sprintf(buf1,"成功接收量= %d",cgl); 
	AfxMessageBox(buf1,MB_OK|MB_ICONINFORMATION); 
} 
 
//====================成功接收率=================== 
void CManager_clientDlg::OnReceiveSuccess()  
{ 
	// TODO: Add your command handler code here 
	//接收的总包数=ifinucastpkts(oid=1.3.6.1.2.1.2.2.1.11.1)+ifinnucastpkts(oid=1.3.6.1.2.1.2.2.1.12.1) 
    //接收的丢弃数+接收的错误数=ifindiscards(1.3.6.1.2.1.2.2.1.13.1)+ifinerrors(1.3.6.1.2.1.2.2.1.14.1) 
	UpdateData(TRUE); 
	char buf1[20]; 
	char buf2[20]; 
	char buf3[20]; 
	char buf4[20]; 
	if(m_edit_save1.GetLength()==0||m_edit_save2.GetLength()==0|| 
		m_edit_save3.GetLength()==0||m_edit_save4.GetLength()==0) 
	{ 
		AfxMessageBox("请先获取数据,详细可以查看使用向导",MB_OK|MB_ICONSTOP); 
		return; 
	} 
	sprintf(buf1,"%s",m_edit_save1.GetBuffer(20)); 
	sprintf(buf2,"%s",m_edit_save2.GetBuffer(20)); 
	sprintf(buf3,"%s",m_edit_save3.GetBuffer(20)); 
	sprintf(buf4,"%s",m_edit_save4.GetBuffer(20)); 
	double ifinucastpkts=atof(buf1); 
	double ifinnucastpkts=atof(buf2); 
	double ifindiscards=atof(buf3); 
	double ifinerrors=atof(buf4); 
	double cgl=((ifinucastpkts+ifinnucastpkts-ifindiscards-ifinerrors)/(ifinucastpkts+ifinnucastpkts)*100); 
	//float fcgl=(float)cgl; 
	sprintf(buf1,"接收成功率= %f",cgl); 
	strcat(buf1,"%"); 
	AfxMessageBox(buf1,MB_OK|MB_ICONINFORMATION); 
	return; 
 
} 
 
//==================================发送的成功数量========================== 
void CManager_clientDlg::OnSendNumber()  
{ 
	// TODO: Add your command handler code here 
	//发送的总包数=ifoutucastpkts(oid=1.3.6.1.2.1.2.2.1.16.1)+ifinnucastpkts(oid=1.3.6.1.2.1.2.2.1.17.1) 
    //发送的丢弃数+发送的错误数=ifindiscards(1.3.6.1.2.1.2.2.1.18.1)+ifinerrors(1.3.6.1.2.1.2.2.1.19.1) 
	UpdateData(TRUE); 
	if(m_edit_save1.GetLength()==0||m_edit_save2.GetLength()==0|| 
		m_edit_save3.GetLength()==0||m_edit_save4.GetLength()==0) 
	{ 
		AfxMessageBox("请先获取数据,详细可以查看使用向导",MB_OK|MB_ICONSTOP); 
		return; 
	} 
	char buf1[20]; 
	char buf2[20]; 
	char buf3[20]; 
	char buf4[20]; 
	sprintf(buf1,"%s",m_edit_save1.GetBuffer(20)); 
	sprintf(buf2,"%s",m_edit_save2.GetBuffer(20)); 
	sprintf(buf3,"%s",m_edit_save3.GetBuffer(20)); 
	sprintf(buf4,"%s",m_edit_save4.GetBuffer(20)); 
 
	int ifoutucastpkts=atol(buf1); 
	int ifoutnucastpkts=atol(buf2); 
	int ifoutdiscards=atol(buf3); 
	int ifouterrors=atol(buf4); 
	int cgl=(ifoutucastpkts+ifoutnucastpkts-ifoutdiscards-ifouterrors); 
	//float fcgl=(float)cgl; 
	sprintf(buf1,"成功接收量= %d",cgl); 
 
	AfxMessageBox(buf1,MB_OK|MB_ICONINFORMATION); 
} 
 
//============================发送的成功率==================================== 
void CManager_clientDlg::OnSendSuccess()  
{ 
	// TODO: Add your command handler code here 
	//发送的总包数=ifoutucastpkts(oid=1.3.6.1.2.1.2.2.1.16.1)+ifinnucastpkts(oid=1.3.6.1.2.1.2.2.1.17.1) 
    //发送的丢弃数+发送的错误数=ifindiscards(1.3.6.1.2.1.2.2.1.18.1)+ifinerrors(1.3.6.1.2.1.2.2.1.19.1) 
	UpdateData(TRUE); 
	if(m_edit_save1.GetLength()==0||m_edit_save2.GetLength()==0|| 
		m_edit_save3.GetLength()==0||m_edit_save4.GetLength()==0) 
	{ 
		AfxMessageBox("请先获取数据,详细可以查看使用向导",MB_OK|MB_ICONSTOP); 
		return; 
	} 
	char buf1[20]; 
	char buf2[20]; 
	char buf3[20]; 
	char buf4[20]; 
	sprintf(buf1,"%s",m_edit_save1.GetBuffer(20)); 
	sprintf(buf2,"%s",m_edit_save2.GetBuffer(20)); 
	sprintf(buf3,"%s",m_edit_save3.GetBuffer(20)); 
	sprintf(buf4,"%s",m_edit_save4.GetBuffer(20)); 
 
	double ifoutucastpkts=atof(buf1); 
	double ifoutnucastpkts=atof(buf2); 
	double ifoutdiscards=atof(buf3); 
	double ifouterrors=atof(buf4); 
	double cgl=((ifoutucastpkts+ifoutnucastpkts-ifoutdiscards-ifouterrors)/(ifoutucastpkts+ifoutnucastpkts)*100); 
	//float fcgl=(float)cgl; 
	sprintf(buf1,"成功接收量= %f",cgl); 
	strcat(buf1,"%"); 
 
	AfxMessageBox(buf1,MB_OK|MB_ICONINFORMATION); 
	 
} 
 
//======================保存信息=============================== 
void CManager_clientDlg::OnFileSave()  
{ 
	// TODO: Add your command handler code here 
	CFileDialog fdlg(FALSE,"txt","manager",OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, 
		                "Text file(*.txt)|*.txt|All Files (*.*)|*.*||"); 
 
	int status=fdlg.DoModal(); 
	if(status!=IDOK) 
	{ 
		return; 
	} 
	else 
	{ 
		CFile f; 
		CFileException fe; 
		if(!f.Open(fdlg.GetPathName(),CFile::modeCreate|CFile::modeWrite,&fe)) 
		{ 
			CString msg; 
			msg.Format("不能打开文件:%s",fe.m_cause); 
			AfxMessageBox(msg,MB_ICONEXCLAMATION|MB_OK); 
			return; 
 
		} 
		TRY 
		{ 
			CTime  nowtime=CTime::GetCurrentTime(); 
			CString dt=nowtime.Format("%H:%M %B %d, %Y"); 
			CString ln; 
			CEdit *output_edit; 
			output_edit=(CEdit *)GetDlgItem(IDC_OUTPUT); 
			int cnt=output_edit->GetLineCount(); 
 
			ln="\r\n 返回信息的结果:\r\n\n"; 
			f.Write(ln,ln.GetLength());           // 
			f.Write(dt,dt.GetLength());           //写入保存时的时间 
			ln.Format("\r\n 总共的行数 %d \r\n\r\n",cnt); 
			f.Write(ln,ln.GetLength()); 
 
			output_edit->GetWindowText(ln); 
			f.Write(ln,ln.GetLength()); 
		} 
		CATCH(CFileException,fe2) 
		{ 
			CString  m2; 
			m2.Format("保存时发生错误: %s",fe2->m_cause); 
			AfxMessageBox(m2,MB_ICONEXCLAMATION|MB_OK); 
			fe2->Delete(); 
			f.Close(); 
			return; 
		} 
		END_CATCH 
			 
			f.Close(); 
 
	} 
	 
} 
 
void CManager_clientDlg::OnFileExit()  
{ 
	// TODO: Add your command handler code here 
		if(m_pSocket) 
		delete m_pSocket; 
	 
	CDialog::OnCancel(); 
} 
//====================进行网络连接================== 
void CManager_clientDlg::OnViewConnect()  
{ 
	// TODO: Add your command handler code here 
	 CConnectDlg dlg;          //调用设置对话框 
	if(dlg.DoModal()==IDOK) 
	{ 
		m_servername=dlg.m_servername;               //赋地址 
		m_portaddress=dlg.m_portaddress;             //赋端口 
		m_pSocket=new CClientUseSocket(); 
		if(!(ConnectServer(m_pSocket))) 
		{ 
			m_pSocket=NULL; 
			return; 
		} 
		else 
			MessageBox("连接成功","客户端程序",MB_OK); 
	} 
} 
//====================断开网络================ 
void CManager_clientDlg::OnViewDisconnect()  
{ 
	// TODO: Add your command handler code here 
	if(m_pSocket) 
	{ 
		delete m_pSocket; 
		m_pSocket=NULL; 
		MessageBox("连接已经断开","客户端程序",MB_OK); 
	} 
	else 
		MessageBox("当前没有连接到服务器!","客户端程序",MB_OK); 
 
} 
//=============================使用向导====================== 
void CManager_clientDlg::OnViewHelp()  
{ 
	// TODO: Add your command handler code here 
	CHelpDlg *helpdlg; 
	helpdlg =new CHelpDlg("向导",this); 
	helpdlg->Create( this); 
}