Are these possible? I have a class with the DWORD CALLBACK function(); defined as a private member of that class, but I keep getting
"cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)"
when I call CreateThread(), wether I have NETWORK::ThreadedReceive and just ThreadedReceive as the third param.
void NETWORK::Receive()
{
if(!receiving&&started_up)
{
receiving=true;
DWORD dwThreadId=1;
HANDLE AcceptThread;
AcceptThread = CreateThread(
NULL, // default security attributes
NULL, // use default stack size
NETWORK::ThreadedReceive, // thread function
NULL, // argument to thread function
NULL, // use default creation flags
&dwThreadId); // returns the thread identifier
}
}
//***********************************************************
DWORD CALLBACK NETWORK::ThreadedReceive(LPVOID lParam)
{
char temp_buffer[30];
int result;
COORD message={0,4},temp={0,10};
while(true)
{
result=recv(Socket,temp_buffer,30,0);
if(result!=0&&result!=SOCKET_ERROR)
receive_buffer=temp_buffer;
}
return NULL;
}
class NETWORK
{
public:
//blah
Receive();
private:
//blah
DWORD CALLBACK ThreadedReceive(LPVOID lParam);
};
hmmm. Could it be because a public function is referencing a private function?
edit: oh i also get the same message when i use DWORD WINAPI function() as msdn does in its example.
[Edited by - Unliterate on September 11, 2004 3:30:39 PM]