![]() |
Thread in C++
:
void Processfile()This function, i need to create it as a thread... I do this :
DWORD d_threadID = 0;Error Quote:
|
The error message is fairly self explanatory. The third argument of CreateThread is a pointer to a function that accepts one argument of type void * and returns an unsigned long. The compiler is complaining because you have attempted to pass it a function that accepts no arguments and returns void.
|
still can not understand..... please guide...
|
I guess this is Win32 API?
You need to use a specific prototype/calling convention for your thread procedure. :
DWORD WINAPI ThreadProc( LPVOID pVoid ) |
ok.. i add (LPTHREAD_START_ROUTINE) for the 3th parameter...
:
DWORD d_threadID = 0;Now there is no error.. BUTTTT... :o :confused: Why the process file did not run? What's wrong???? Anybody see what wrong? please inform.. your help will be very much appreciate... :
void Processfile() |
Sigh. As I said earlier, your function ProcessFile() takes no arguments and returns void. It needs to accept a void pointer and return an unsigned long.
:
unsigned long ProcessFile(void *)Using a cast, as in :
CreateThread(NULL,In this case it would also be a good idea to eliminate the (LPDWORD) cast as well from your call. Telling the compiler that &d_threadID is a pointer to a DWORD does not magically turn d_threadID into a DWORD. |
| All times are GMT -5. The time now is 5:12 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC