、接收都实现。在CTalkDlg类中添加函数OnClose()函数,添加如下代码:M_sConnectSocket.Close();GetDlgItem(IDC_EDIT_MSG)->EnableWindow(Flase);GetDlgItem(IDOK)->EnableWindow(Flase);GetDlgItem(IDC_STATIC_MSG)->EnableWindow(Flase);GetDlgItem(IDC_BTN_CONNECT)->EnableWindow(Flase);GetDlgItem(IDC_BTN_CLOSE)->EnableWindow(Flase);While(m_listSent.GetCount()!=0)?M_listSent.DeleteString(0);While(m_listReceived.GetCount()!=0)?M_listReceived.DeleteString(0);If(m_cmbType.GetCurSel()==1){?GetDlgItem(IDC_BTN_CONNECT)->EnableWindow(True);GetDlgItem(IDC_EDIT_SERVNAME)->EnableWindow(True);GetDlgItem(IDC_EDIT_SERVPORT)->EnableWindow(True);GetDlgItem(IDC_STATIC_SERVNAME)->EnableWindow(True);GetDlgItem(IDC_STATIC_SERVPORT)->EnableWindow(True);GetDlgItem(BO_TYPE)->EnableWindow(True);}双击“断开”按钮,添加如下代码:VoidCTalkDlg::OnBtnClose(){?OnClose();}27