I'm new to threads and Winforms/C++. I would like to start a function in a new thread when I press a button. I was following this as a tutorial for threads. When I build the example code given on that site in a separate VC++ project, the build succeeds.
However, if I do the following in my C++/Winforms the build won't complete, I get a build error.
What am I missing here?
Help!
Code:
void Test( void *arg );
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
_beginthread(Test, 0, (void*)12);
}
void Test( void *arg )
{
// Do something
}
Build ERROR:
Error 1 error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__clrcall *)(void *)' to 'void (__cdecl *)(void *)' c:\users\documents\visual studio 2010\projects\statsv2.0\statsv2.0\Form1.h 659 1 StatsV2.0