D
daniel
Hello ,
I have the following code :
//...additional includes cut off
class MyThread{
public:
DWORD WINAPI ThreadProc( LPVOID lpParameter );
void run();
};
DWORD WINAPI MyThread::ThreadProc(LPVOID lpParameter){
cout<<"Thread called\n";
return 0;
}
void MyThread::run(){
CreateThread(NULL, 0, MyThread::ThreadProc, NULL, 0, NULL); //<---
LINE
}
void main(void){
MyThread p;
p.run();
}
When i compile this ( with MSVS 2005 ) i get the following compile
error:
LINE: error C3867: 'MyThread::ThreadProc': function call missing
argument list; use '&MyThread::ThreadProc' to create a pointer to
member.
Then I add &MyThread:ThreadProc instead of MyThread::ThreadProc and i
get another compile error:
LINE: error C2664: 'CreateThread' : cannot convert parameter 3 from
'DWORD (__stdcall MyThread::* )(LPVOID)' to 'LPTHREAD_START_ROUTINE'
Any logic explanation?
Thank-you ,
Daniel
I have the following code :
//...additional includes cut off
class MyThread{
public:
DWORD WINAPI ThreadProc( LPVOID lpParameter );
void run();
};
DWORD WINAPI MyThread::ThreadProc(LPVOID lpParameter){
cout<<"Thread called\n";
return 0;
}
void MyThread::run(){
CreateThread(NULL, 0, MyThread::ThreadProc, NULL, 0, NULL); //<---
LINE
}
void main(void){
MyThread p;
p.run();
}
When i compile this ( with MSVS 2005 ) i get the following compile
error:
LINE: error C3867: 'MyThread::ThreadProc': function call missing
argument list; use '&MyThread::ThreadProc' to create a pointer to
member.
Then I add &MyThread:ThreadProc instead of MyThread::ThreadProc and i
get another compile error:
LINE: error C2664: 'CreateThread' : cannot convert parameter 3 from
'DWORD (__stdcall MyThread::* )(LPVOID)' to 'LPTHREAD_START_ROUTINE'
Any logic explanation?
Thank-you ,
Daniel