谢谢!

解决方案 »

  1.   

    用全局变量保存socket。关闭对话框的时候不要关闭socket。
      

  2.   

    改为全局变量后,出现以下错误:
    Linking...
    BSDConfigWnd.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    BSDStateView.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    BSDStateWnd.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    ChildFrm.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    LoginDlg.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    MainFrm.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    SpyBSD.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    SpyBSDDoc.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    SpyClientSocket.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    RestartDlg.obj : error LNK2005: "class CSpyClientSocket  g_ClientSocket" (?g_ClientSocket@@3VCSpyClientSocket@@A) already defined in BSDConfigView.obj
    Release/SpyBSD.exe : fatal error LNK1169: one or more multiply defined symbols found
    Error executing link.exe.SpyBSD.exe - 11 error(s), 0 warning(s)