PC Review


Reply
Thread Tools Rate Thread

Application can't be interrupted when running in a loop

 
 
Rvo
Guest
Posts: n/a
 
      3rd Aug 2004
I have written an application that manipulates files, while doing so the
program is running in a loop and any actions on the GUI will not get any
response. When I try to stop the processing of the files trough the GUI by
clicking on a button this will not be done.

The action connected to the stop-button is to set a boolean to "true"
in the loop which processes the files I check contiuously for the boolean
becomming true and if so exit the loop.
But this condition is never set to true.

Is there a way to write code that still accepts user input while running in
a loop?

Kind regards,

Romain Voes


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Aug 2004
* "Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> scripsit:
> I have written an application that manipulates files, while doing so the
> program is running in a loop and any actions on the GUI will not get any
> response. When I try to stop the processing of the files trough the GUI by
> clicking on a button this will not be done.
>
> The action connected to the stop-button is to set a boolean to "true"
> in the loop which processes the files I check contiuously for the boolean
> becomming true and if so exit the loop.
> But this condition is never set to true.


I would use multithreading to do that. You can find a sample here:

<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 
Reply With Quote
 
Rvo
Guest
Posts: n/a
 
      3rd Aug 2004
Dear Herfried,

It works just fine. Thanks.

Romain

"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> * "Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> scripsit:
> > I have written an application that manipulates files, while doing so the
> > program is running in a loop and any actions on the GUI will not get any
> > response. When I try to stop the processing of the files trough the GUI

by
> > clicking on a button this will not be done.
> >
> > The action connected to the stop-button is to set a boolean to "true"
> > in the loop which processes the files I check contiuously for the

boolean
> > becomming true and if so exit the loop.
> > But this condition is never set to true.

>
> I would use multithreading to do that. You can find a sample here:
>
>

<URL:http://dotnet.mvps.org/dotnet/sample...s/FileSystemEn
umerator.zip>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Simple window application with a loop and a button to eventuallystop the loop Joe Cool Microsoft C# .NET 15 29th Jul 2009 08:40 PM
Interrupted upgrade to SP2 running windows xp pro =?Utf-8?B?QmFycnkwMjE=?= Windows XP General 3 6th Oct 2006 09:06 PM
Application requires the installation of sql.wce4.armv4.cab for it to run properly. install the Cab file before running this application ayrookuzhy Microsoft Dot NET Compact Framework 1 30th Jan 2006 07:38 PM
Installation of application INTERRUPTED!!! Any ideas? =?Utf-8?B?Q3Jhenlpbk5K?= Windows XP Customization 13 6th Dec 2004 04:19 PM
Installer infinite loop when running application Mike Microsoft Windows 2000 MSI 1 3rd Jan 2004 01:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 AM.