d119.bmp.txt

来自「Visual C++通信编程实例」· 文本 代码 · 共 44 行

TXT
44
字号
ProcessPendingAccept(). CloseSessionSocket0,代码如-F:
void CLANChatDlg::ProcessPendingAccept()
{
          CChatClient* pSocket = new CChatClient();
                       if (m_pListenS ocket.Accept(*pS ocket》
          {
                POSITION pos;
                                             for(pos=m_connectionList.GetHeadPositionO;pos ! =NULL;)
                    {
                              CChatClient * t= (CChatClient *)m_connectionList.GetNext(pos);
t->SendMessage(&msg);
                    }
pSocket->lnit(this);
                                             m_connectionList.AddTail(pS ocket);
          }
 else
                delete pSocket;
}
void CLANChatDlg::CloseSessionSocket()
{
                  if( !m_ bClient)
          {
                                    for(POSITION pos=m_connectionList.GetHeadPosition();pos ! =NULL;)
                    {
                        POSITION t_pos=pos;
                           CChatClient * t = (CChatClient*)m_connectionList.GetNext(pos);
if(t->m_bClose==true)
                           {
m_connectionList.RemoveAt(t_pos);
                           }
                    }
          }
}
    抒开ClassWizard,为消息对话框(IDC_INPUTMSG)的EN_UPDATE事件添加事件处
理函数,编辑该函数。从对话框中输入消息内容,并在历史消息对话框中显示的功能,均在
此函数中实现。
void CLANChatDlg::OnInputMsg0
{
               // TODO: If this is a RICHEDIT control, the control will not
            // send this notification unless you override the CDialog::OnInitDialog()
           // function to send the EM_SETEVENfMASK message to the control
           // with the ENM_UPDATE flag ORed into the lParam mask.
119

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?