mfc关于IP地址控件

获取IP地址控件内容:

 TCHAR szDBAddr[21];

 DWORD dwAddress;

((CIPAddressCtrl*)(GetDlgItem(IDC_IPADDR)))->GetAddress(dwAddress);
 _snwprintf_s(szIPAddr,sizeof(szIPAddr),TEXT("%d.%d.%d.%d"),
  *(((BYTE *)&dwAddress)+3),*(((BYTE *)&dwAddress)+2),*(((BYTE *)&dwAddress)+1),*((BYTE *)&dwAddress));

设置IP地址控件内容:

 DWORD dwAddress = inet_addr(CT2CA(szIPAddr));
 ((CIPAddressCtrl*)(GetDlgItem(IDC_IPADDR)))->SetAddress(htonl(dwAddress));

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页