下面这段代码中的m_ServerIp.GetAddress(f0,f1,f2,f3); //有点问题??
编译的时候说:left of '.GetAddress' must have class/struct/union type
请高手指点下,为什么会出现这种Debug?完整的方法代码如下:
   void CExample1Dlg::OnConnect() 
{
// TODO: Add your control notification handler code here
BYTE f0,f1,f2,f3;
m_ServerIp.GetAddress(f0,f1,f2,f3); //有点问题
CString add;
add.Format("%d.%d.%d.%d",f0,f1,f2,f3); if(m_client.InitAndConnet(m_hWnd,m_uPort,add)==FALSE)
return;
}
其中的m_ServerIp好象是一个EDIT控件的变量?

解决方案 »

  1.   

    m_ServerIp 应该要ip控件, edit控件没有办法。CIPAddressCtrl::GetAddress
    int GetAddress( BYTE& nField0, BYTE& nField1, BYTE& nField2, BYTE& nField3 );int GetAddress( DWORD& dwAddress );Return ValueThe number of non-blank fields in the IP Address Control.ParametersnField0A reference to the field 0 value from a packed IP address. nField1A reference to the field 1 value from a packed IP address.nField2A reference to the field 2 value from a packed IP address.nField3A reference to the field 3 value from a packed IP address.dwAddressA reference to the address of a DWORD value that receives the IP address. See Res for a table that shows how dwAddress is filled.ResThis member function implements the behavior of the Win32 messageIPM_GETADDRESS, as described in the Platform SDK.In the first prototype above, the numbers in fields 0 through 3 of the control, read left to right respectively, populate the four parameters. In the second prototype above, dwAddress is populated as follows.Field Bits containing the field value 
    0 24 through 31 
    1 16 through 23 
    2 8 through 15 
    3 0 through 7 
      

  2.   

    我按照你说的原因去改,又多了很多debug:错误如下
    Compiling...
    Client.cpp
    Example1.cpp
    Example1Dlg.cpp
    Server.cpp
    Generating Code...
    Linking...
    Client.obj : error LNK2001: unresolved external symbol _connect@12
    Client.obj : error LNK2001: unresolved external symbol _htons@4
    Server.obj : error LNK2001: unresolved external symbol _htons@4
    Client.obj : error LNK2001: unresolved external symbol _inet_addr@4
    Client.obj : error LNK2001: unresolved external symbol _socket@12
    Server.obj : error LNK2001: unresolved external symbol _socket@12
    Client.obj : error LNK2001: unresolved external symbol _closesocket@4
    Example1Dlg.obj : error LNK2001: unresolved external symbol _closesocket@4
    Server.obj : error LNK2001: unresolved external symbol _closesocket@4
    Client.obj : error LNK2001: unresolved external symbol _send@16
    Example1Dlg.obj : error LNK2001: unresolved external symbol _send@16
    Client.obj : error LNK2001: unresolved external symbol _recv@16
    Example1Dlg.obj : error LNK2001: unresolved external symbol _recv@16
    Client.obj : error LNK2001: unresolved external symbol _WSAAsyncSelect@16
    Server.obj : error LNK2001: unresolved external symbol _WSAAsyncSelect@16
    Example1Dlg.obj : error LNK2001: unresolved external symbol _WSAStartup@8
    Example1Dlg.obj : error LNK2001: unresolved external symbol _accept@12
    Server.obj : error LNK2001: unresolved external symbol _listen@8
    Server.obj : error LNK2001: unresolved external symbol _bind@12
    Debug/Example1.exe : fatal error LNK1120: 12 unresolved externals
    Error executing link.exe.Example1.exe - 20 error(s), 0 warning(s)
    这个我就看不懂拉,请楼上的指点下。谢谢
    告诉我邮箱我可以把源代码发给你。
      

  3.   

    stdafx.h
    add->
    #pragma comment(lib, "ws2_32.lib")
      

  4.   

    按照提示是把debug全部除去拉:
       但是我的界面是这样的:
      这边一个TextBox            ServerIP 然后一个IP控件跟在后面
      用来显示收到的信息         ServerPort 默认是4000    两个按钮                 连接服务器      建立服务器
      这里还有一个TextBox
       用来发送信息的            还有一个确定按钮  我点了先建立服务器,后点连接服务器。然后在发送信息,但是Textbox里没收到信息。
    这是为什么啊?
      因为不能把界面粘贴过来,我只好描述下拉,请楼上的告诉我为什么?谢谢!~!