Windows C++ Thread Parameter Passing
No, that's the only way. Just create a struct with the 2 data members and pass that as void*
#include <windows.h>
#include <stdio.h>
struct PARAMETERS
{
int i;
int j;
};
DWORD WINAPI SummationThread(void* param)
{
PARAMETERS* params = (PARAMETERS*)param;
printf("Sum of parameters: i + j = \n", params->i + params->j);
return 0;
}
int main()
{
PARAMETERS params;
params.i = 1;
params.j = 1;
HANDLE thdHandle = CreateThread(NULL, 0, SummationThread, ¶ms, 0, NULL);
WaitForSingleObject(thdHandle, INFINITE);
return 0;
}