Threads & WindowsForms(VC++.NET)

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 so I have to
define a class (MyClass) containing the thread method (Func) and the default
and normal constructors .
well the problem now is that if I defined the class at the begining of the
form file
my class can't see the form .
otherwise if I defined my class at the end of it the form wouldn't see it
I solved this by forward declaration of my class
a new problem appeared I recieved an error message "Form1.h(77): error
C2512: 'test::MyClass' : no appropriate default constructor available
"while I already defined the required constructors .
 
M

Marcus Heege

Basel Al-Khateeb said:
Hello there,
I have a problem with windows form that is
Iam trying to create a thread that needs to access my form so I have to
define a class (MyClass) containing the thread method (Func) and the
default
and normal constructors .
well the problem now is that if I defined the class at the begining of the
form file
my class can't see the form .
otherwise if I defined my class at the end of it the form wouldn't see it
I solved this by forward declaration of my class
a new problem appeared I recieved an error message "Form1.h(77): error
C2512: 'test::MyClass' : no appropriate default constructor available
"while I already defined the required constructors .

Why don't you instantiate the ThreadStart delegate outside form1.h?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top