hi, i am new in programming and now dealing with some multi threading stuff
anyway i got problem when trying to use member function when doing threads
i searched around the net and found that 1 method is by using messages which is rather complex
another method that somebody posted is by casting:
Code:
DWORD pg_control::thr ( LPVOID lpvParam ) // static
{
pg_control *thr = (pg_control*)lpvParam;
thr->get_hosts(0,NULL);
// Go on with code ...
return 0;
}
void pg_control::OnNn()
{
AfxBeginThread ( (AFX_THREADPROC)pg_control::thr, (LPVOID)this );}
however i get some errors
C:\Program Files\Microsoft Visual Studio\MyProjects\abc.cpp(222) : error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
AClient.exe - 1 error(s), 0 warning(s)
the problem lies in the red text
can anyone please correct and enlighten me?
thanks!
- using winxp programming for win98se
- MFC style
- VC++6.0 SP6