Currently I use:
DWORD ThreadProc(LPVOID lpParameter)
{
void (* function)() = (void (*)())lpParameter;
function();
return 0;
}
void Threading(HANDLE &hThread, DWORD &ThreadID, void* FunctionToPass)
{
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (void*)FunctionToPass, 0, &ThreadID);
}
And I want to call it like:
Handle hThread; DWORD ThreadID;
Threading(hThread, ThreadID, AnyFunctionHere);
That way my Threading Function will create a thread and run any function. How can I pass it a function that has 0 or more parameters?