请问如何获得网络信息,例如主机的IP地址等????? 同上 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 gethostnamegethostbyname============================================================================http://www.betajin.com/alphasun/index.htmDocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析 //取得网卡全部信息GetAdaptersInfo();//详见MSDNWindows NT/2000: Requires Windows 2000. Windows 95/98: Requires Windows 98. Header: Declared in Iphlpapi.h. Library: Use Iphlpapi.lib. void GetIP(){ CString str; char szhostname[128]; if( gethostname(szhostname, 128) == 0 ) { struct hostent * phost; int i; phost = gethostbyname(szhostname);//如果知道主机名就省掉前面的 for( i = 0; phost!= NULL && phost->h_addr_list[i]!= NULL; i++ ) { int j; for( j = 0; j<phost->h_length; j++ ) { CString addr; if( j > 0 ) str += "."; addr.Format("%u", (unsigned int)((unsigned char*)phost->h_addr_list[i])[j]); str += addr; } } } AfxMessageBox("你的IP地址为:"+str+"!");} FindWindow()怎么获取隐藏窗口的句柄 如何AppendChunk 插入数据时,从我新建的字段第一行开始插起。 为啥我7月份一直挂在线上? 如何实现CListCtrl控件的编辑功能,并嵌套Combo Box ?最好有具体步骤,谢谢 获取其它应用程序的消息? 怎样在对话框里面直接划一个矩形的区域 读注注册表问题(附代码) 问题应该不难,但让我这个新手抓耳挠腮!!!全局变量怎么在哪声明?? 诚心请教!急! 请教清屏的函数???????帮忙了 请教,将"12345678910ca1212"这样的字符串右移1位? 怎么得到自己在公网中的IP,有这样的函数吗????
gethostbyname============================================================================
http://www.betajin.com/alphasun/index.htm
DocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析
GetAdaptersInfo();//详见MSDN
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
{
CString str;
char szhostname[128];
if( gethostname(szhostname, 128) == 0 )
{
struct hostent * phost;
int i;
phost = gethostbyname(szhostname);//如果知道主机名就省掉前面的
for( i = 0; phost!= NULL && phost->h_addr_list[i]!= NULL; i++ )
{
int j;
for( j = 0; j<phost->h_length; j++ )
{
CString addr;
if( j > 0 )
str += ".";
addr.Format("%u", (unsigned int)((unsigned
char*)phost->h_addr_list[i])[j]);
str += addr;
}
}
}
AfxMessageBox("你的IP地址为:"+str+"!");
}