G
Guest
Hello there,
I have a problem with windows form that is
Iam trying to create a thread that needs to access my form
I defined a member function called func
void func()
{
//stuff
this->prop = val ;
}
then I created the thread in a button_click event like this
On_Button_Click(.....)
{
using namespace System::Threading ;
ThreadStart * TS = new ThreadStart(0,this->Func);
Thread * T = new Thread(TS);
T->Start();
}
when I compile I recieve an error message
Form1.h(78): error C3351: 'System::Threading::ThreadStart' :
if you pass a NULL object instance to a delegate constructor you must also
pass the address of a static member function
as you see it asks me to declare the "func" method as a static member function
the problem is that I need to use "this" pointer inside the "func" method so
I can't define it
as a static member function.
instead how can I pass a non-static method to the ThreadStart delegate? in
other words
what is the first parameter of the delegate which is of type "System::Object
__gc* "?
Thanks alot to you "reader"
Iam really in love with Microsoft® >>>.
Keep going >>>.
I have a problem with windows form that is
Iam trying to create a thread that needs to access my form
I defined a member function called func
void func()
{
//stuff
this->prop = val ;
}
then I created the thread in a button_click event like this
On_Button_Click(.....)
{
using namespace System::Threading ;
ThreadStart * TS = new ThreadStart(0,this->Func);
Thread * T = new Thread(TS);
T->Start();
}
when I compile I recieve an error message
Form1.h(78): error C3351: 'System::Threading::ThreadStart' :
if you pass a NULL object instance to a delegate constructor you must also
pass the address of a static member function
as you see it asks me to declare the "func" method as a static member function
the problem is that I need to use "this" pointer inside the "func" method so
I can't define it
as a static member function.
instead how can I pass a non-static method to the ThreadStart delegate? in
other words
what is the first parameter of the delegate which is of type "System::Object
__gc* "?
Thanks alot to you "reader"
Iam really in love with Microsoft® >>>.
Keep going >>>.