The third parameter of
CreateThread[
^] API is a pointer to your thread procedure.
This function must be strictly declared as described
here[
^].
You didn't post the declaration of your thread procedure and your call to
CreateThread
so it is hard to tell where exactly is the problem but looking at your error message (
cannot convert parameter 3 from 'DWORD (__stdcall *)(void)' to 'LPTHREAD_START_ROUTINE&'
) I suspect that your thread procedure function does not take any parameters. If this is the case, change your function to take a pointer to
void
(
LPVOID
) if not please post some code.
:)
[Update]
Declare your thread procedure as:
static DWORD WINAPI timerThread(LPVOID lpParameter)
.
Some comments:
- Your call to
CreateThread
indicates that
timerThread
is declared in
CIODialogDlg
class, but your function definition is not prefixed with the class name (
CIODialogDlg::
).
- Also the declaration of
timerThread
does not take any parameter (which is incorrect) but the definition takes parameter.
So it is all inconsistent and messed up. Please have a look at some examples of creating threads using
CreateThread
:
-
Example from MSDN[
^]
-
CodeProject article on CreateThread[
^]
-
MSDN thread on the topic[
^]
Also consider using
_beginthreadex[
^] or
AfxBeginThread[
^] as a better alternatives of create thread.
[/Update]