Void cgetipdlg :: ONQUERY () {char wshostname [128]; // Storage host name
IF (gethostname (128) == 0) // correct case {m_hostname.setwindowText (wshostname); struct hostent * phost; int client;
Phost = gethostByname (wshostname); // Phost returned to a list of hosts for (Client = 0; phost! = null && phst-> h_addr_list [client]! = null; client ) {lpcstr psz = inet_ntoa (* (Struct) IN_ADDR *) Phost-> h_addr_list [client]); // Get PSZ variable m_ip.addstring (PSZ) pointing to IP;}}}