我作了基于MFC的ActiveX 控件,可现在的socket链接有问题,什么原因吖?我做了个控件XViewer
//XViewerCtrl.h
{
    ........
private:
    CCommand m_Command;
}//Command.h
class CCommand
{
    ........
    Connect(CString szIP, int iPort);
private:
    CCmdSocket m_CmdSock;
}
//Command.cpp
BOOL CCommand::Connect(CString szIP, int iPort)
{
    if(!m_CmdSock.Create())
        return FALSE;
    if(!m_CmdSock.AsyncSelect())
        return FALSE;    m_CmdSock.Connect(szIP.GetBuffer(szIP.GetLength()), iPort);
    return TRUE;
}//发送单字节命令
//CmdSocket
class CCmdSocket::CAsyncSocket
{
    ........
    public:
    virtual void OnConnect(int nErrorCode);
    virtual void OnReceive(int nErrorCode);
}其中
void CCmdSocket::OnConnect(int nErrorCode) 
{
    CXViewerCtrl *pWnd = (CXViewerCtrl *)AfxGetMainWnd();    pWnd->Connect(nErrorCode);
    CAsyncSocket::OnConnect(nErrorCode);
}void void CXViewerCtrl::Connect(int iErrorCode)
{
    ........
    ;
}我首先调用    m_Command.Connect(m_szServerIP, m_iServerCmdPort);开始程序我启动了一个服务器程序在指定的端口监听,来调试控件.当调试到CXViewerCtrl::Connect函数内部时,
我发现Watch调试窗口里面的m_Command以及m_CmdSock的Value已经变成了CXX0030: Error: expression 
cannot be evaluated了.而在Command.cpp 和 CmdSocket.cpp文件中调试时,m_CmdSock的值都是合法的,什么原因吖?

解决方案 »

  1.   

    各位到这里看看吖,帮帮小弟拉.弄不明白吖.
    在dlg程序里面好好的socket搬到activeX控件里面后就有问题,不能建立链接.是socket问题还是activeX问题吖?????????????????????
      

  2.   

    大家帮我看看代码吖,我的email地址是[email protected]
    qq 27812478,是大狭就过来帮我看看吖.我可以把代码发给大家,问题看起来很简洁.可就是链接不上吖. ???????????
      

  3.   

    悬赏200分吖
    真的很需要大家的帮助,而且 急 ! [email protected]