M
Michael Gorbach
Iv got a little bit of a threading problem.
Iv got a form which handles events fired by an object running on
another thread (the event handlers are executed on a thread differnet
from the form's gui thread). Im using BeginInvoke to call methods on
the form that manipulate its GUI elements, as is reuqired. The problem
is this: When that particular form is closed and the object is still
running, the events still fire and get caught by the event handlers.
The BeginInvoke call fails with an InvalidOperationException (something
about the window handle not being created). Although i can catch this
excpetion and ignore it, doing this would slow down my prgoram alot and
would break the guideline of not having exceptions thrown during normal
program execution (it is normal for this form to be closed, as it is a
helper form). How do i check if the form is open and has a window
associated with it?
Iv got a form which handles events fired by an object running on
another thread (the event handlers are executed on a thread differnet
from the form's gui thread). Im using BeginInvoke to call methods on
the form that manipulate its GUI elements, as is reuqired. The problem
is this: When that particular form is closed and the object is still
running, the events still fire and get caught by the event handlers.
The BeginInvoke call fails with an InvalidOperationException (something
about the window handle not being created). Although i can catch this
excpetion and ignore it, doing this would slow down my prgoram alot and
would break the guideline of not having exceptions thrown during normal
program execution (it is normal for this form to be closed, as it is a
helper form). How do i check if the form is open and has a window
associated with it?