我在对话框类中用
CListBox *pListBox=static_cast<CListBox*>(GetDlgItem(IDC_LIST2));
pListBox->AddString(_T("Server thread entered"));
语句可以顺利添加。
但是在外部定义的函数或是线程中,编译不通过,显示
error C2660: 'GetDlgItem' : function does not take 1 arguments请问该如何解决?
CListBox *pListBox=static_cast<CListBox*>(GetDlgItem(IDC_LIST2));
pListBox->AddString(_T("Server thread entered"));
语句可以顺利添加。
但是在外部定义的函数或是线程中,编译不通过,显示
error C2660: 'GetDlgItem' : function does not take 1 arguments请问该如何解决?
是直接在GetDlgItem前面加::吗?还是不行啊
尝试这样之后编译器仍然报错:
error C2039: 'AddString' : is not a member of 'CWnd'
试试
pLB->AddString(_T("Server thread entered")); 但最好如7楼所说方法,不要在线程里直接更新界面