Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Long Process Interruption
Message
De
19/01/2001 13:17:48
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Long Process Interruption
Divers
Thread ID:
00465868
Message ID:
00465868
Vues:
44
I'm writing a complicated process program and am not sure how to implement a user interrupt mechanism.

This is a long process, so I have a form that will display status messages. After the needed setup, there's a READ EVENTS command. Then, the form has a "Start Process" button to get things going. Once started, the legend changes to "Cancel" and it's Cancel property set to .T. (so that Esc will activate it).

There is a global variable, bAborted, that the process code periodically checks so that it "knows" it must terminate. The Cancel button is set to change this to .T. When stepping thru the code, this works fine.

But, during normal running, it doesn't work; clicking the button and pressing Escape (SET ESCAPE is OFF) don't stop the process at all. Apparently, there's no time to service the button's Click() method as the process program is running at full tilt.

To solve this, I periodically issue an INKEY(1) command (and look for an Esc keypress that will also set the variable). This works. However, I can't help but think that there must be a better way to do this.

Can anyone offer suggestions?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform