类库用是Ws2_32.lib
但是这个函数在有的机器可以,有的又不行,请问什么原因?
但是这个函数在有的机器可以,有的又不行,请问什么原因?
解决方案 »
- 请问我用DrawText为什么输出的文字在矩形外面?
- 如何更新ListCtrl的header?如何改变ListCtrl滚动条的宽度?
- 求取4个子串的算法
- 给大家一个API创建多文档界面的框架
- 寻找<<Visual C++图形用户界面开发指南>>!!!
- delete 和 delete [] 的区别?
- 把一个组件注册成为系统服务跟一般的dll有什么区别吗
- WIN2000系统可以承受的线程数是多少,跟系统配置关系大吗?
- 挑战高手,这段vc代码有何不妥?
- 我的对话框有点问题,我的成员变量都初始化正确,但是只有CEdit显示正常,CComboBox显示空的,Why?
- Up分,大家赶快来
- (给高分)Vc改如何学??
#pragma comment(lib,"ws2_32")
and before you use this function you should init socket,there is my some code:
int CMyDialog::GetIPAddress(const CString &sHostName, CString &sIPAddress)
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
{
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return 0;
}
...
}