VC++ 将IP字符串转为 DWORD值

CString strIP="192.168.1.184";   

DWORD dwAddress= ntohl( inet_addr(strIP));   

m_IPAddr.SetAddress(dwAddress);
//---------------------------------------

DWORD dwMainServerIP;  
m_MainServerIPCtrl.GetAddress(dwMainServerIP);  
strMainServerIP.Format(_T("%d.%d.%d.%d"),   
(dwMainServerIP>>24)&0xff,   
(dwMainServerIP>>16)&0xff,   
(dwMainServerIP>>8)&0xff,   
dwMainServerIP&0xff ) ;
原文地址:https://www.cnblogs.com/lujin49/p/4762405.html