这个问题我也有过vc代码
实在需要我可以帮dll
[email protected]
void CUuipDlg::OnButton1() 
{

// TODO: Add extra validation here
CString strOut;
WORD wVersionRequested;
WSADATA wsaData;
int num=0;
wVersionRequested = MAKEWORD(1, 1);
if(WSAStartup(wVersionRequested, &wsaData))
  {
  printf("ERROR No.1!!! Program Terminate.");
//  return 0;
  }char s[128];
char *p2;
if(gethostname(s, 128)==SOCKET_ERROR)
  {
  printf("ERROR No.2!!! Program Terminate.");
//  return 0;
  }hostent *p = gethostbyname(s);
if(!p)
  {
  printf("ERROR!!! Bad host lookup. Program Terminate.");
//  return 0;
  }strOut.Format("Local Computer Name: %s\n",s);
md=strOut+md;strOut.Format("Local Host Name: %s\n",p->h_name);int i=0;
while(p->h_aliases[i])
  {
  strOut.Format("                %s\n",p->h_aliases[i]);
  i++;
  }
md=strOut+md;//Get the IpAddress
for(i=0;p->h_addr_list[i]!=0;i++)
  {
  p2 = inet_ntoa(*((in_addr *)p->h_addr_list[i]));
  strOut.Format("Local IP Adress: %s\n",p2);
  }
md=strOut+md;
WSACleanup();
 UpdateData(false);
}