//将CString 型IP地址在IPAddressCtrl中显示
CString strIP="192.168.0.10";
DWORD dwIP;
dwIP = inet_addr(strIP);
unsigned char *pIP = (unsigned char*)&dwIP;
m_ipAddr.SetAddress(*pIP, *(pIP+1), *(pIP+2), *(pIP+3));
//将IPAddressCtrl中的IP地址获得并转换成CString型
unsigned char *pIP;
CString strIP;
DWORD dwIP;
m_ipAddr.GetAddress(dwIP);
pIP = (unsigned char*)&dwIP;
strIP.Format("%u.%u.%u.%u",*(pIP+3), *(pIP+2), *(pIP+1), *pIP);
//CIPAddressCtrl的值转换成CString,CString转换成CIPAddressCtrl
CString strIP="192.168.1.184";
m_IPAddr.SetWindowText(strIP);
CString strIP;
m_IPAddr.GetWindowText(strIP);
CString strIP="192.168.1.184";
DWORD dwAddress= ntohl( inet_addr(strIP));
m_IPAddr.SetAddress(dwAddress);
//为控件设置数据
m_addr.SetAddress(192,168,0,2);
//从控件得到数据
BYTE b1,b2,b3,b4;
m_addr.GetAddress(b1,b2,b3,b4);