Error 1 error C3867: 'GenericThread::ThreadProc': function call missing argument list; use '&GenericThread::ThreadProc' to create a pointer to member ...\GenericThread\GenericThread.cpp 19
IDE : MS Visual Studio 2005
GenericThread.h
Code:
#pragma once
#include <Windows.h>
class GenericThread
{
public:
GenericThread();
~GenericThread();
// Create and run the thread
void Start(LPVOID lpParameter, int nPriority = 0, bool create_suspended = false, SIZE_T stack_size = 0, bool reserve_stack = false);
// This member function will run when you call StartThread()
DWORD WINAPI ThreadProc(LPVOID lpParameter);
// -15 : lowest; +15 : highest
void SetPriority(int nPriority);
// Get currently assigned priority level
int GetPriority();
// Get thread status
bool IsRunning();
// Pause execution
void Suspend();
// Resume execution
void Resume();
// Terminate execution
void Terminate();
// Return thread handle
HANDLE GetHandle();
private:
// Handle to the thread
HANDLE m_hThread;
// The thread id assigned by Windows, there is no use for now
LPDWORD m_lpdwThreadID;
// You can use this property to signal the ThreadProc() to prepare for termination
bool m_bExiting;
// Thread status
bool m_bRunning;
};
#pragma once
#include <Windows.h>
class GenericThread
{
public:
GenericThread();
~GenericThread();
// Create and run the thread
void Start(LPVOID lpParameter, int nPriority = 0, bool create_suspended = false, SIZE_T stack_size = 0, bool reserve_stack = false);
// This member function will run when you call StartThread()
static DWORD WINAPI ThreadProc(LPVOID lpParameter);
//...
Without it, since your ThreadProc function is a member of the GenericThread class, it has an implicit "this" pointer as the first parameter. As such, it doesn't match the function argument for CreateThread.
Bookmarks