views:

173

answers:

1
+2  A: 

The problem here is that you are trying to use a function for a ThreadStart delegate which has an incompatible signature. ThreadStart is a delegate which has no arguments and returns no value. You are trying to use a method though which takes 4 arguments. This won't work.

You'll need to instead pass in a method which takes no arguments.

To pass parameters in C++, your best bet is to create a new class which has all of the parameters as fields. Then give it a method which has no parameters and returns no value and use that as the ThreadStart target.

ThreadHelper^ h = gcnew ThreadHelper();
h->Param1 = someValue;
ThreadStart^ threadDelegate = gcnew ThreadStart( h, &ThreadHelper::DoMoreWork );

There is a full example of this on the ThreadStart documentation page

JaredPar