K
Klaus Löffelmann
Hello,
I understand, that it is allowed to create a new form in a seperate thread
as long as this form gets its own message pump via application.run.
(See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/casoast.asp,
even if this example is for the compact framework and here
http://www.dotnet247.com/247reference/msgs/33/165734.aspx).
If I then want to execute an extensive operation in that form, I have to
apply Application.DoEvents to keep that form "alive". But on what message
pump(s?) does the DoEvents take effect?
The reason I ask is: When I ran some tests in a Virtual PC, DoEvents caused
a Overflow-Exception once in a while. On my "real" machine it ran ok every
time a tried.
Is that the right method to solve this problem, at all? (Keep in mind that I
want to create a generic, reusable class that has to show its own UI no
matter in which winforms application it's hosted in. So, creating a form
from the UI-Thread, running the thread independently from the UI, and only
updating controls via invoke would be to avoid, if possible).
Maybe someone knows some other links to articles that are dealing with this
stuff.
Thanks,
Klaus
I understand, that it is allowed to create a new form in a seperate thread
as long as this form gets its own message pump via application.run.
(See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/casoast.asp,
even if this example is for the compact framework and here
http://www.dotnet247.com/247reference/msgs/33/165734.aspx).
If I then want to execute an extensive operation in that form, I have to
apply Application.DoEvents to keep that form "alive". But on what message
pump(s?) does the DoEvents take effect?
The reason I ask is: When I ran some tests in a Virtual PC, DoEvents caused
a Overflow-Exception once in a while. On my "real" machine it ran ok every
time a tried.
Is that the right method to solve this problem, at all? (Keep in mind that I
want to create a generic, reusable class that has to show its own UI no
matter in which winforms application it's hosted in. So, creating a form
from the UI-Thread, running the thread independently from the UI, and only
updating controls via invoke would be to avoid, if possible).
Maybe someone knows some other links to articles that are dealing with this
stuff.
Thanks,
Klaus