Error c2664: 'createthread': cannot convert parameter 3 from 'unsigned long (void *) 'to 'unsigned long (_ stdcall *) (void *)'
Solution:
(1) If the thread is executing a member function of the class, it must be declared as a static function using static.
For example:
Class echo
{
Static DWORD winapi threadfunc (lpvoid pvoid)
......
......
}
(2) global functions are generally called.
When we use createthread (null, 0, threadproc, null, 0, null) to create a thread, this function requires the function address in the new thread, there are two common solutions:
1. Declare the new thread function we want to call to DWORD winapi threadproc (lpvoid lpparameter ).
2. We can declare the new thread function as a member function in the class: static DWORD winapi threadproc (lpvoid lpparameter)
However, when we write incorrectly, error c2664: 'createthread': cannot convert parameter 3 from 'unsigned long (void *) may often occur *) the question of 'to 'unsigned long (_ stdcall *) (void *)' is also annoying for our beginners,