Multithreading - form not activated

S

Simon

Hi,
I wrote a little programm for handling files which opens a
new form with a progressbar while reading the content of a
directory (it displays the reading-progress, obvious huh?
=) ). It all works like it should, the progressbar grows,
the current filename is shown. the main window does the
whole directory scanning and just calls some functions of
the progress-window (increment, showfilename etc).

There's just one problem I'm not able to solve - the
progresswindow sometimes just doesn't react on user-input.
The "Abort"-Button or the "x" (to close the window) just
don't react. The button cannot be pushed - but the window
still receives the function-calls from the mainwindow,
i.e. it doesn't crash or something else. It only occurs
sometimes. I already tried to Activate() the form (it
already has focus though) and some other things and
nothing worked. The strange thing is, that if I click on
the abort-button and it doesn't react, it handles the push-
button as if it happened on the mainwindow below (after
the progress window disappears).
 
H

Herfried K. Wagner [MVP]

* "Simon said:
I wrote a little programm for handling files which opens a
new form with a progressbar while reading the content of a
directory (it displays the reading-progress, obvious huh?
=) ). It all works like it should, the progressbar grows,
the current filename is shown. the main window does the
whole directory scanning and just calls some functions of
the progress-window (increment, showfilename etc).

There's just one problem I'm not able to solve - the
progresswindow sometimes just doesn't react on user-input.
The "Abort"-Button or the "x" (to close the window) just
don't react. The button cannot be pushed - but the window
still receives the function-calls from the mainwindow,
i.e. it doesn't crash or something else. It only occurs
sometimes. I already tried to Activate() the form (it
already has focus though) and some other things and
nothing worked. The strange thing is, that if I click on
the abort-button and it doesn't react, it handles the push-
button as if it happened on the mainwindow below (after
the progress window disappears).

Use the control's/form's 'Invoke' method to access it from an other
thread.
 

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