char HostName[100];
gethostname(HostName, sizeof(HostName));// 获得本机主机名.
this->m_host_name.SetWindowTextA(HostName);
hostent* hn;
hn = gethostbyname(HostName);//根据本机主机名得到本机ip
char * strIPAddr=inet_ntoa(*(struct in_addr *)hn->h_addr_list[0]);//把ip换成字符串形式
this->m_host_ip.SetWindowTextA(strIPAddr);
gethostname(HostName, sizeof(HostName));// 获得本机主机名.
this->m_host_name.SetWindowTextA(HostName);
hostent* hn;
hn = gethostbyname(HostName);//根据本机主机名得到本机ip
char * strIPAddr=inet_ntoa(*(struct in_addr *)hn->h_addr_list[0]);//把ip换成字符串形式
this->m_host_ip.SetWindowTextA(strIPAddr);
this->UpdateData(0);