Getting IP Address from IP Control
-
Hi , I am trying to get IP Address from an IP Control using below code. But I am getting an IP Address in Reverse Order , like if my IP Contrl has 123.45.67.89 , then inet_ntoa () method return address as 89.67.45.123. Can you provide any information on how to get IP Address from IP Control.
DWORD dwIPAddress ;
::SendMessage (hwndIPAddress,IPM_GETADDRESS,0, (LPARAM) (LPDWORD) &dwIPAddress ) ;
struct in_addr addr;
addr.S_un .S_addr = (ULONG)dwIPAddress ;
char *IPAddres = new char[9] ;
IPAddres = inet_ntoa (addr) ; -
Hi , I am trying to get IP Address from an IP Control using below code. But I am getting an IP Address in Reverse Order , like if my IP Contrl has 123.45.67.89 , then inet_ntoa () method return address as 89.67.45.123. Can you provide any information on how to get IP Address from IP Control.
DWORD dwIPAddress ;
::SendMessage (hwndIPAddress,IPM_GETADDRESS,0, (LPARAM) (LPDWORD) &dwIPAddress ) ;
struct in_addr addr;
addr.S_un .S_addr = (ULONG)dwIPAddress ;
char *IPAddres = new char[9] ;
IPAddres = inet_ntoa (addr) ;DWORD dwIPAddress = 0;
::SendMessage (hwndIPAddress, IPM_GETADDRESS, 0, (LPARAM)&dwIPAddress);
struct in_addr addr;
addr.S_un.S_addr = (ULONG)dwIPAddress ;
char IPAddress[16] ;
sprintf(IPAddress, "%d.%d.%d.%d", addr.S_un.s_b1, addr.S_un.s_b2, addr.S_un.s_b3, addr.S_un.s_b4);«_Superman_» _I love work. It gives me something to do between weekends.
-
DWORD dwIPAddress = 0;
::SendMessage (hwndIPAddress, IPM_GETADDRESS, 0, (LPARAM)&dwIPAddress);
struct in_addr addr;
addr.S_un.S_addr = (ULONG)dwIPAddress ;
char IPAddress[16] ;
sprintf(IPAddress, "%d.%d.%d.%d", addr.S_un.s_b1, addr.S_un.s_b2, addr.S_un.s_b3, addr.S_un.s_b4);«_Superman_» _I love work. It gives me something to do between weekends.
-
Hi , I am trying to get IP Address from an IP Control using below code. But I am getting an IP Address in Reverse Order , like if my IP Contrl has 123.45.67.89 , then inet_ntoa () method return address as 89.67.45.123. Can you provide any information on how to get IP Address from IP Control.
DWORD dwIPAddress ;
::SendMessage (hwndIPAddress,IPM_GETADDRESS,0, (LPARAM) (LPDWORD) &dwIPAddress ) ;
struct in_addr addr;
addr.S_un .S_addr = (ULONG)dwIPAddress ;
char *IPAddres = new char[9] ;
IPAddres = inet_ntoa (addr) ;htonl() converts an IPv4 address in host byte order (e.g. mac or pc format) to the IPv4 address in network byte order. inet_ntoa() converts an (Ipv4) Internet network address into an ASCII string.