// IPAddressCtrl中的IP地址转为CString
CIPAddressCtrl* pIp = (CIPAddressCtrl*)GetDlgItem(IPADDRESS); BYTE bytIp1, bytIp2, bytIp3, bytIp4; pIp->GetAddress(bytIp1, bytIp2, bytIp3, bytIp4); CString strIp; strIp.Format(_T("%u.%u.%u.%u"), bytIp1, bytIp2, bytIp3, bytIp4);
// CString转为IPAddressCtrl中的IP地址 CString strIP = _T("192.168.0.1"); USES_CONVERSION; DWORD dwIP = inet_addr(W2A(strIP)); PBYTE bytIp = (PBYTE)&dwIP; pIp->SetAddress(*bytIp, *(bytIp + 1), *(bytIp + 2), *(bytIp + 3));