Threads and Classes
I''m having a bit of trouble with this one. When a member function of my class is called, the function''s only job is to create a thread. The the function I specify in CreateThread is a member function of the same class, but it wont work. I get this error:
Info :Making...
Info :Compiling C:\BC5\BIN\BGP\bgp.cpp
Error: bgp.cpp(903,58):Member function must be called or its address taken
Now the only code that produces this error is as follows:
bool BGP::RunThread()
{
CreateThread( NULL,
0,
(LPTHREAD_START_ROUTINE)MyThread,
(LPVOID) hWnd,
0,
&Tid1);
return true;
}
DWORD BGP::MyThread()
{
return 0;
}
What have I done wrong?
MyThread has a hidden parameter (this). Make it (MyThread) static to avoid that, and pass this where you''re passing hWnd (store hWnd inside the class) if you need it.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement