Is it possible to get IP address of the web sites which IE are browsing? I want to get the IP address in the program.Please show me some code, if possible. Thanks.

解决方案 »

  1.   

    you can get url first in IE address bar,then call "gethostbyname" to get the IP addresses.
      

  2.   

    how to get url for IE? you can use IE com interface or use API findwindowEx.
    http://expert.csdn.net/Expert/topic/1338/1338542.xml?temp=.212414
      

  3.   

    Thanks, I cannot open the link: "http://www.csdn.net/develop/read_article.asp?id=8997"
      

  4.   

    just www.csdn.net is ok
      

  5.   

    if u wanna get a link like this http://www.csdn.net/develop/read_article.asp?id=8997u ought to resolve domain name and replace original link like this
    http://211.157.102.21/develop/read_article.asp?id=8997anyway, I don't know why u need it.Just host ip or not?socket? wininet? through proxy? confused....
      

  6.   

    hostent* pHost = gethostbyname("www.csdn.net");
    in_addr hostaddr;
    memcpy(hostaddr,pHost->h_addr,pHost->h_length);
    char* pszIP = inet_ntoa(hostaddr);