UINT CSockettestDlg::ComputeThreadProc(LPVOID pParam)
{
struct sockaddr_in remote_addr;
int sin_size=sizeof(struct sockaddr_in);
while(1)
{
if((client_fd=accept(sockfd,(struct sockaddr *)&remote_addr,&sin_size))!=-1)
GetDlgItem(IDC_BUTTON1,GetSafeHwnd())->SetWindowText("断开");
}
return 0;
}编译出现error C2352: 'CWnd::GetSafeHwnd' : illegal call of non-static member function
f:\vc98\mfc\include\afxwin.h(1912) : see declaration of 'GetSafeHwnd'
D:\网络通信\sockettest\sockettestDlg.cpp(197) : error C2227: left of '->SetWindowTextA' must point to class/struct/union换成GetDlgItem(IDC_BUTTON1)->SetWindowText("断开");也不行
{
struct sockaddr_in remote_addr;
int sin_size=sizeof(struct sockaddr_in);
while(1)
{
if((client_fd=accept(sockfd,(struct sockaddr *)&remote_addr,&sin_size))!=-1)
GetDlgItem(IDC_BUTTON1,GetSafeHwnd())->SetWindowText("断开");
}
return 0;
}编译出现error C2352: 'CWnd::GetSafeHwnd' : illegal call of non-static member function
f:\vc98\mfc\include\afxwin.h(1912) : see declaration of 'GetSafeHwnd'
D:\网络通信\sockettest\sockettestDlg.cpp(197) : error C2227: left of '->SetWindowTextA' must point to class/struct/union换成GetDlgItem(IDC_BUTTON1)->SetWindowText("断开");也不行
解决方案 »
- Cansyncsocket 怎样在网络上实现大文件的分包发送。
- 网络嗅探器的问题为什么运行之后都是68到67端口的数据包啊?
- 一个C语言内存管理问题
- CFileDialog获取多个文件名的顺序问题
- 一个关于端口扫描的程序,在线等,谢谢,有分
- 200分求NURBS曲面绘图的程序,需要有光照,能够鼠标转动
- 有一URL,在浏览器里每刷新一次就会返回不同的内容,可是在我的程序里总是同一返回,何解?帮帮忙啦
- 我做的网站,请各位高手提点意见http://www.ydsoftware.com.cn
- ADO MYSQL怎么不能连上非本机数据库呢?本地操作没问题!!
- 关于serialize的问题?
- 如何设置多个TIMER
- CEdit销毁有ASSERT(m_hWnd == hWndOrig);的错误
pDlg ->GetDlgItem(IDC_BUTTON1,GetSafeHwnd())->SetWindowText("断开");
前提是你传窗口类的指针给线程
http://topic.csdn.net/u/20110225/08/597acd2c-b454-4356-9f94-266cfab6e29e.html
然后通过
pDlg->GetDlgItem(IDC_BUTTON1)->SetWindowText("断开");
这种应该是 传窗口句柄给线程,线程发消息给窗口让其更新界面....
在Create线程的时候传给线程函数。
线程函数里面再进行一次类型转换。
这样就可以访问那个类型了。