M
me
I have a Class Library that contains a Form and several helper classes. A
thread gets created that performs processing of data behind the scenes and
the Form never gets displayed (it is for debug puposes only and is not
normally visable to the user.) The Thread function is actually in the Form
class.
Now.. What I am seeing is that when I create an instance of this Class
Library's Form, which starts the worker thread, it seems to hose up the
displaying of the Form (it sees to be locked up) unless I place a
Application.DoEvents() call inside my worker threads function.
What this seems to tell me is that the thread I have created is blocking the
redrawing of the Form.. which doesnt make sense to me at all.
I have tried several ways to "resolve" this and here is what I have seen so
far:
1. DoEvents() in the Thread function seems to allow the Form to work
correctly.
2. Calling Show() and then Hide() of the Form before I start my worker
thread seems to allow me to then show and hide the Form later without any
problems.
3. If I do not show it and do not call DoEvents() then the Form does not
update when I perform a Show() later.
Any thoughts? I am almost thinking that the Form is not creating it's own
internal Message Handling thread until it is actually Show()'n and then when
it does it sees that I have a worker thread and attaches to it? Sounds
strange to me but that is what it looks like??
Any help would be appreciated.. You can email me at (e-mail address removed)
with any info you have.. I may not have access to this group later.....
Thx.
thread gets created that performs processing of data behind the scenes and
the Form never gets displayed (it is for debug puposes only and is not
normally visable to the user.) The Thread function is actually in the Form
class.
Now.. What I am seeing is that when I create an instance of this Class
Library's Form, which starts the worker thread, it seems to hose up the
displaying of the Form (it sees to be locked up) unless I place a
Application.DoEvents() call inside my worker threads function.
What this seems to tell me is that the thread I have created is blocking the
redrawing of the Form.. which doesnt make sense to me at all.
I have tried several ways to "resolve" this and here is what I have seen so
far:
1. DoEvents() in the Thread function seems to allow the Form to work
correctly.
2. Calling Show() and then Hide() of the Form before I start my worker
thread seems to allow me to then show and hide the Form later without any
problems.
3. If I do not show it and do not call DoEvents() then the Form does not
update when I perform a Show() later.
Any thoughts? I am almost thinking that the Form is not creating it's own
internal Message Handling thread until it is actually Show()'n and then when
it does it sees that I have a worker thread and attaches to it? Sounds
strange to me but that is what it looks like??
Any help would be appreciated.. You can email me at (e-mail address removed)
with any info you have.. I may not have access to this group later.....
Thx.