
illegal call of non-static member function
Hi!
You cannot call non-static function GetDlgItem() from static SockThread()
( no "this" so it know nothing
about current CDlg )
What you need to do is to put CDlg * as parameter to SockThread and and call
there GetDlgItem
In Create thread "this" have to be set as a parameter to thead
and thread function :
DWORD CDlg::SockThread(LPVOID p) {
static_cast<CDlg *>(p)->GetDlgItem(IDC_ACCEPT);
return XX ; // you forgot return code here and my usual error in class
definition of CDlg you forgot ";" after }
Quote:
}
HTH
Arkady
Quote:
> // in CDlg.h
> Class CDlg : CDialog {
> public:
> static DWORD SockThread(LPVOID);
> }
> // in CDlg.cpp
> DWORD CDlg::SockThread(LPVOID) {
> CDlg::GetDlgItem(IDC_ACCEPT);
> //OR GetDlgItem(IDC_ACCEPT);
> }
> the IDC_ACCEPT is a button, and following compile error occurred
> CDlg.cpp(139) : error C2352: 'CWnd::GetDlgItem' : illegal call of
non-static
> member function